unite | R Documentation |
Convenience function to paste together multiple columns.
unite(data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE)
data |
A |
col |
|
... |
The columns to unite. |
sep |
|
remove |
|
na.rm |
|
A data.frame
with the columns passed via ...
pasted together in a new column.
df <- data.frame(x = c("a", "a", NA, NA), y = c("b", NA, "b", NA))
df
df %>% unite("z", x:y, remove = FALSE)
# To remove missing values:
df %>% unite("z", x:y, na.rm = TRUE, remove = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.