powered by
If a column contains observations with multiple delimited values, separate them each into their own row.
separate_rows.(.df, ..., sep = "[^[:alnum:].]+", convert = FALSE)
A data.frame or data.table
Columns to separate across multiple rows. tidyselect compatible
tidyselect
Separator delimiting collapsed values
If TRUE, runs type.convert() on the resulting column. Useful if the resulting column should be type integer/double.
type.convert()
df <- data.table( x = 1:3, y = c("a", "d,e,f", "g,h"), z = c("1", "2,3,4", "5,6") ) separate_rows.(df, y, z) separate_rows.(df, y, z, convert = TRUE)
Run the code above in your browser using DataLab