I have a data frame containing
df
Date name score
12/09/2012 Mahesh\nRahul 120
13/09/2012 abc\nxyz\nrep 110
...........................
i have tried this in order to get atomic
name1=str_split(df[,2],"\n")
but dont know how to associate again ,what is the best way to make data frame normalize so that i can get
df
Date name score
12/09/2012 Mahesh 120
12/09/2012 Rahul 120
13/09/2012 abc 110
13/09/2012 xyz 110
13/09/2012 rep 110
...........................
any help to make normalized a long data frame in R.
Edit
please note that it is just a reproducible example ,i have multiple names in my name column and number of names varies from one row to other row .thanks.
dput(df) structure(list(Date = structure(1:2, .Label = c("12/09/2012", "13/09/2012 "), class = "factor"), name = structure(c(2L, 1L), .Label = c("abc\nxyz", "Mahesh\nRahul"), class = "factor"), score = structure(c(2L, 1L), .Label = c("110", "120"), class = "factor")), .Names = c("Date", "name", "score"), row.names = c(NA, -2L), class = "data.frame")