Convenience function to paste together multiple columns into one.
Usage
unite(data, col, ..., sep = "_", remove = TRUE)
Arguments
data
A data frame.
col
(Bare) name of column to add
...
Specification of columns to unite. Use bare variable names.
Select all variables between x and z with x:z, exclude y with
-y. For more options, see the select documentation.
sep
Separator to use between values.
remove
If TRUE, remove input columns from output data frame.
library(dplyr)
unite_(mtcars, "vs_am", c("vs","am"))
# Separate is the complement of unitemtcars %>%
unite(vs_am, vs, am) %>%
separate(vs_am, c("vs", "am"))