unite | R Documentation |
Convenience function to paste together multiple columns into one.
unite(.df, col = ".united", ..., sep = "_", remove = TRUE, na.rm = FALSE)
.df |
A data.frame or data.table |
col |
Name of the new column, as a string. |
... |
Selection of columns. If empty all variables are selected.
|
sep |
Separator to use between values |
remove |
If TRUE, removes input columns from the data.table. |
na.rm |
If TRUE, NA values will be not be part of the concatenation |
df <- tidytable(
a = c("a", "a", "a"),
b = c("b", "b", "b"),
c = c("c", "c", NA)
)
df %>%
unite("new_col", b, c)
df %>%
unite("new_col", where(is.character))
df %>%
unite("new_col", b, c, remove = FALSE)
df %>%
unite("new_col", b, c, na.rm = TRUE)
df %>%
unite()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.