I have a list and a dataframe. The data frame has has two columns, one for song, one for song type. I have a list of songs, for type one song.
allsongs <- data.frame("Song" = c(1, 2, "3A", "9C", 6, 5, "12B", "32A", 18, 27, 24, "1D"),
"Type" = 0)
type1songs <- list(c(1, 2, "32A", 6, "1D"))
I would like to use this list to apply the value of "1" to the $Type of all the songs in the dataframe, that are in that list.
So it would look something like this.
Song Type
1 1 1
2 2 1
3 3A NA
4 9C NA
5 6 1
6 5 NA
7 12B NA
8 32A 1
9 18 NA
10 27 NA
11 24 NA
12 1D 1
How do I do that?