unite_dt | R Documentation |
Convenience function to paste together multiple columns into one.
unite_dt(
.data,
united_colname,
...,
sep = "_",
remove = FALSE,
na2char = FALSE
)
.data |
A data frame. |
united_colname |
The name of the new column, string only. |
... |
A selection of columns. If want to select all columns, pass "" to the parameter. See example. |
sep |
Separator to use between values. |
remove |
If |
na2char |
If |
unite
,separate_dt
df <- expand.grid(x = c("a", NA), y = c("b", NA))
df
# Treat missing value as NA, default
df %>% unite_dt("z", x:y, remove = FALSE)
# Treat missing value as character "NA"
df %>% unite_dt("z", x:y, na2char = TRUE, remove = FALSE)
df %>%
unite_dt("xy", x:y)
# Select all columns
iris %>% unite_dt("merged_name",".")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.