powered by
If a variable contains observations with multiple delimited values, this separates the values and places each one in its own row.
separate_rows(data, ..., sep = "[^[:alnum:].]+", convert = FALSE)
A data frame.
<tidy-select> Columns to separate across multiple rows
tidy-select
Separator delimiting collapsed values.
If TRUE will automatically run type.convert() on the key column. This is useful if the column types are actually numeric, integer, or logical.
TRUE
type.convert()
df <- tibble( x = 1:3, y = c("a", "d,e,f", "g,h"), z = c("1", "2,3,4", "5,6") ) separate_rows(df, y, z, convert = TRUE)
Run the code above in your browser using DataLab