I am dealing with a large existing data frame that has a column that I need to "transpose" into multiple rows, while retaining the original user Id in each row.
Note the contents of the favs column is literally a string that includes "c( ... )". A simplified version is shown here:
**uId** **favs**
1000 c('pizza')
1001 c('seafood','steaks')
1002 NA
1003 c('sushi','strawberries')
The output I want:
**uId** **favs**
1000 pizza
1001 seafood
1001 steaks
1002 NA
1003 sushi
1003 strawberries
What is the most efficient way to this? I was consider melt/dcast but not sure how to apply it here since the FAVS column needs to be unlisted and will then contain a varying number of elements.