1

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.

Kevin
  • 333
  • 1
  • 3
  • 9
  • 7
    `df %>% separate_rows(y)` per the first couple of results when googling for your question title - http://stackoverflow.com/a/37979009/496803 – thelatemail Apr 05 '17 at 00:39

0 Answers0