Suppose I have this data frame:
df <- data.frame(ids=c('1,2','3,4'), vals=c('a', 'b'))
and I want to end up with this one:
data.frame(ids=c('1', '2', '3', '4'), vals=c('a', 'a', 'b', 'b'))
In words: one separate row for each value in the comma-separated lists in ids, with the associated vals duplicated.
I'd like to use the tidyverse. I'm pretty sure I should use pivot_longer, maybe with names_sep, but after reading and fiddling it's not obvious to me.
Help?