rename()
changes the names of individual variables using
new_name = old_name
syntax; rename_with()
renames columns using a
function.
# S3 method for class 'SummarizedExperiment'
rename(.data, ...)
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details.
For rename()
: <tidy-select
> Use
new_name = old_name
to rename selected variables.
For rename_with()
: additional arguments passed onto .fn
.
An object of the same type as .data
. The output has the following
properties:
Rows are not affected.
Column names are changed; column order is preserved.
Data frame attributes are preserved.
Groups are updated to reflect new names.
This function is a generic, which means that packages can provide implementations (methods) for other classes. See the documentation of individual methods for extra arguments and differences in behaviour.
The following methods are currently available in loaded packages:
(vector
, Vector
), dplyr (data.frame
), plotly (plotly
), tidySummarizedExperiment (SummarizedExperiment
)
.
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., François, R., Henry, L., Müller, K., Vaughan, D. (2023). dplyr: A Grammar of Data Manipulation. R package version 2.1.4, https://CRAN.R-project.org/package=dplyr
data(pasilla)
pasilla |> rename(cond=condition)
#> 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(2): cond type