Description Usage Arguments Value Examples
In a data frame with a column or columns where entries are comma-separated lists of values, split entries with multiple values, and put them into separate rows. Eventually there will be only "one value per row" in the specified column(s).
1 | one_per_row(data, columns, sep = ",")
|
data |
Data frame |
columns |
Columns of data frame in which to spread multi-value entries across multiple rows |
sep |
Separator used in multi-value entries |
A data frame with the same columns as ‘d’ but where there is only one value per row in the columns ‘cols’.
1 2 3 4 5 6 7 | d <- read.table(text = "
x y z
1 a,c A,C
2 b,d B,D
3 e E
", header = TRUE, stringsAsFactors = FALSE)
one_per_row(d, c("y", "z"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.