View source: R/PA.EMOA.dataprocessing.R
explode | R Documentation |
Given a data frame and a column name, function
explode
splits the content of a column by a specified
delimiter (thus exploded) into multiple columns. Function implode
does vice versa, i.e., given a non-empty set of column names or
numbers, the function glues together the columns. Hence, functions
explode
and implode
are kind of inverse to each other.
explode(df, col, by = ".", keep = FALSE, col.names = NULL)
implode(df, cols, by = ".", keep = FALSE, col.name)
df |
[ |
col |
[ |
by |
[ |
keep |
[ |
col.names |
[ |
cols |
[ |
col.name |
[ |
[data.frame
] Modified data frame.
df = data.frame(x = 1:3, y = c("a.c", "a.b", "a.c"))
df.ex = explode(df, col = "y", col.names = c("y1", "y2"))
df.im = implode(df.ex, cols = c("y1", "y2"), by = "---", col.name = "y", keep = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.