Convenience function to paste together multiple columns into one.
# S3 method for class 'SummarizedExperiment'
unite(data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE)A data frame.
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
Separator to use between values.
If TRUE, remove input columns from output data frame.
If TRUE, missing values will be removed prior to uniting
each value.
tidySummarizedExperiment
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
separate(), the complement.
tidySummarizedExperiment::pasilla |>
unite("group", c(condition, type))
#> ℹ tidySummarizedExperiment says: Key columns are missing. A data frame is returned for independent data analysis.
#> # A SummarizedExperiment-tibble abstraction: Features=14599 | Samples=7 |
#> # Assays=counts
#> # |------ COVARIATES ----|
#> .feature .sample | counts | group |
#> <chr> <chr> | <chr> | <chr> |
#> 1 FBgn0000003 untrt1 | 0 | untreated_single_end |
#> 2 FBgn0000008 untrt1 | 92 | untreated_single_end |
#> 3 FBgn0000014 untrt1 | 5 | untreated_single_end |
#> 4 FBgn0000015 untrt1 | 0 | untreated_single_end |
#> 5 FBgn0000017 untrt1 | 4664 | untreated_single_end |
#> -------- ------- - ------ - ----- -
#> 102189 FBgn0261571 trt3 | 0 | treated_paired_end |
#> 102190 FBgn0261572 trt3 | 3 | treated_paired_end |
#> 102191 FBgn0261573 trt3 | 1908 | treated_paired_end |
#> 102192 FBgn0261574 trt3 | 3047 | treated_paired_end |
#> 102193 FBgn0261575 trt3 | 4 | treated_paired_end |