res <- jsonlite::fromJSON("http://www.bison-fute.gouv.fr/previsions/previsions.json")
library(tidyverse)
prev_bf <- tibble(
days = res$days,
depts = list(res$deptsLine[1:94]),
depart = map(res$values, ~ strsplit(.x[1:94], split = ",")) %>% modify_depth(2, 1) %>% simplify_all(),
retour = map(res$values, ~ strsplit(.x[1:94], split = ",")) %>% modify_depth(2, 2) %>% simplify_all()
) %>%
unnest()
prev_bf
#> # A tibble: 39,574 x 4
#> days depts depart retour
#> <chr> <chr> <chr> <chr>
#> 1 15/11/2017 75 V V
#> 2 15/11/2017 77 V V
#> 3 15/11/2017 78 V V
#> 4 15/11/2017 91 V V
#> 5 15/11/2017 92 V V
#> 6 15/11/2017 93 V V
#> 7 15/11/2017 94 V V
#> 8 15/11/2017 95 V V
#> 9 15/11/2017 2 V V
#> 10 15/11/2017 14 V V
#> # ... with 39,564 more rows
Created on 2018-10-05 by the reprex package (v0.2.1)