unite {poorman} | R Documentation |
Unite Multiple Columns Into One
Description
Convenience function to paste together multiple columns.
Usage
unite(data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE)
Arguments
data |
A |
col |
|
... |
The columns to unite. |
sep |
|
remove |
|
na.rm |
|
Value
A data.frame
with the columns passed via ...
pasted together in a new column.
Examples
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)
[Package poorman version 0.2.7 Index]