datacamp-logo

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?

Answer the question
50 XP
Possible Answers
  • press
  • press
  • press