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.
right now it's because i'm dealing with lyric data from the geniusR package, and lyrics are outputted as a list of lists. And right now I'm joining a data frame of instrumental songs (so no lyrics), and, for consistency's sake, I wanted to add this specific list of lists to those songs.
And also I'm in a pretty huge rush to finish this (due tomorrow!), so I'm just going with what I've got