I have a data frame with one field that is a string containing a comma-separated list of names. I want to expand the data frame so that I have multiple rows from each original row, the number of rows being the number of names in the list. So, I want to change something like
df <- data.frame(f1=c("a","b"), f2=c("b","e"), f3=c("a,b,c", "a,d"))
df
f1 f2 f3
a b a,b,c
d e a,d
into
df
f1 f2 f3
a b a
a b b
a b c
d e a
d e d
I suspect that dplyr and/or reshape2 are the tools for the job, but I'm not sure how to apply them in this case.