So I have this list of lists and inside each list I have elements that are vectors of equal lengths and a single value in one element. I want to create a tibble of the vectors and store the tibble in the list of lists.
> neighbours
$p1
$p1$course_names
[1] "X1" "X2" "X3"
$p1$course_capacities
[1] 1 1 1
$p1[[2]]
[1] 4.123106
$p2
$p2$course_names
[1] "X1" "X2" "X3"
$p2$course_capacities
[1] 1 1 1
$p2[[2]]
[1] 4.123106
Final output should look like this:
> neighbours
[[1]]
[[1]][[1]]
# A tibble: 10 x 4
course_names course_capacities
<chr> <dbl>
1 X1 1.00
2 X2 1.00
3 X3 1.00
[[1]][[2]]
[1] 4.123106
[[2]]
[[1]][[1]]
# A tibble: 10 x 4
course_names course_capacities
<chr> <dbl>
1 X1 1.00
2 X2 1.00
3 X3 1.00
[[2]][[2]]
[1] 4.123106
I guess I'd prefer a tidyverse solution since I am looking for tibbles. Of course, I am happy to consider any approach.