I have a data that has a structure looking like df
below, but I need to turn that into df2
. Is there a function in the tidyverse
that can do this?
df = data.frame(x = 1:3, y = c("a", "a b", "a b c"))
df2 = data.frame(x = c(1,2,2,3,3,3), y = c("a", "a", "b", "a", "b", "c"))
Thanks.