Convenience function to paste together multiple columns into one.

# S3 method for class 'SummarizedExperiment'
unite(data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE)

Arguments

data

A data frame.

col

The name of the new column, as a string or symbol.

This argument is passed by expression and supports quasiquotation (you can unquote strings and symbols). The name is captured from the expression with rlang::ensym() (note that this kind of interface where symbols do not represent actual objects is now discouraged in the tidyverse; we support it here for backward compatibility).

...

<tidy-select> Columns to unite

sep

Separator to use between values.

remove

If TRUE, remove input columns from output data frame.

na.rm

If TRUE, missing values will be removed prior to uniting each value.

Value

tidySummarizedExperiment

References

Hutchison, W.J., Keyes, T.J., The tidyomics Consortium. et al. The tidyomics ecosystem: enhancing omic data analyses. Nat Methods 21, 1166–1170 (2024). https://doi.org/10.1038/s41592-024-02299-2

Wickham, H., Vaughan, D. (2023). tidyr: Tidy Messy Data. R package version 2.0.0, https://CRAN.R-project.org/package=tidyr

See also

separate(), the complement.

Examples

tidySummarizedExperiment::pasilla |>
    unite("group", c(condition, type))
#> tidySummarizedExperiment says: Key columns are missing. A data frame is returned for independent data analysis.
#> class: SummarizedExperiment 
#> dim: 14599 7 
#> metadata(0):
#> assays(1): counts
#> rownames(14599): FBgn0000003 FBgn0000008 ... FBgn0261574 FBgn0261575
#> rowData names(0):
#> colnames(7): untrt1 untrt2 ... trt2 trt3
#> colData names(1): group