About list-columns
You've been introduced in the video to a new kind of data structure: list columns. List-columns are, as their name suggests, columns which behave like lists, but are inside a special kind of dataframe — a tibble, which are an implementation of dataframe used in the tidyverse.
Nested dataframes — dataframes with list-columns, look like standard dataframes, but cells of that columns are not of length 1, and can contain any kind of elements. Just like a list.
df <- data.frame(
classic = c("a", "b","c"),
list = list(
c("a", "b","c"),
c("a", "b","c", "d"),
c("a", "b","c", "d", "e")
)
)
df
# A tibble: 3 x 2
classic list
<chr> <list>
1 a <chr [3]>
2 b <chr [4]>
3 c <chr [5]>
But why is this a useful format?
Deze oefening maakt deel uit van de cursus
Intermediate Functional Programming with purrr
Praktische interactieve oefening
Zet theorie om in actie met een van onze interactieve oefeningen.
Begin met trainen