expandDups | R Documentation |
Expand one entry, which is separated into different part (which may have different meanings) by a common separator, into multiple lines. Note: this function may destroy your data in some way, since its simply "copy" the rest columns to each entry, so you should be well aware of the meaning of your data.
expandDups(x, id = 1, sep = ",")
x |
a data frame or tibble |
id |
column index of variable needs to expand, which has separators defined as |
sep |
separator |
Yujie Liu
x <-
data.frame(
x1 = c("A,A,A", "B,B", "C"),
x2 = c(1, 2, 3),
x3 = c("100,100,200", "200,200", "300")
)
expandDups(x, id = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.