powered by
If a column contains observations with multiple delimited values, separate them each into their own row.
separate_longer_delim(.df, cols, delim, ...)
A data.frame or data.table
Columns to separate
Separator delimiting collapsed values
These dots are for future extensions and must be empty.
df <- data.table( x = 1:3, y = c("a", "d,e,f", "g,h"), z = c("1", "2,3,4", "5,6") ) df %>% separate_longer_delim(c(y, z), ",")
Run the code above in your browser using DataLab