unite

0th

Percentile

Unite multiple columns into one.

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.
See Also

separate(), the complement.

unite_ for a version that uses regular evaluation and is suitable for programming with.

Aliases
  • unite
Examples
library(dplyr)
unite_(mtcars, "vs_am", c("vs","am"))

# Separate is the complement of unite
mtcars %>%
  unite(vs_am, vs, am) %>%
  separate(vs_am, c("vs", "am"))
Documentation reproduced from package tidyr, version 0.6.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.