How would I go about mutating a new variable called tracks to a data frame, where each row's value for tracks is the following list?
list(track_title = character(0), lyric = character(0), line = integer(0))
Here's an example:
artists <- c("Spiritualized", "Ween", "Death Grips")
albums <- c("Pure Phase", "Quebec", "The Money Store")
mydata <- data_frame(artists, albums)
mydata
# A tibble: 3 x 2
artists albums
<chr> <chr>
1 Spiritualized Pure Phase
2 Ween Quebec
3 Death Grips The Money Store
I guess what I'm trying to do is end up with this:
# A tibble: 3 x 3
artists albums tracks
<chr> <chr> <list>
1 Spiritualized Pure Phase list(track_title = character(0), lyric = character(0), line = integer(0))
2 Ween Quebec list(track_title = character(0), lyric = character(0), line = integer(0))
3 Death Grips The Money St~ list(track_title = character(0), lyric = character(0), line = integer(0))
I know this is a weird way to go about things, but I kinda need my data formatted this way. Normal mutate(mydata, tracks = list(...)) doesn't work here, so I think I need some map-related solution.
Any ideas?