
Rename Columns in the Sample or Variable Information Tibble
rename_obs.Rd
These two functions provide a way to rename columns in the sample or variable
information tibble of an experiment()
.
The same syntax as dplyr::rename()
is used.
For example, to rename the "group" column in the sample information tibble to "condition",
use rename_obs(exp, condition = group)
.
Note that you can't rename the "sample" column in the sample information tibble,
as well as the "variable" column in the variable information tibble.
These two columns are used to link the sample or variable information tibble
to the expression matrix.
Arguments
- exp
An
experiment()
.- ...
<
data-masking
> Name pairs to rename. Usenew_name = old_name
to rename columns.
Value
An new experiment()
object.
Examples
toy_exp <- toy_experiment()
toy_exp
#>
#> ── Experiment ──────────────────────────────────────────────────────────────────
#> ℹ Expression matrix: 6 samples, 4 variables
#> ℹ Sample information fields: group and batch
#> ℹ Variable information fields: protein, peptide, and glycan_composition
# Rename columns in sample information tibble
rename_obs(toy_exp, condition = group)
#>
#> ── Experiment ──────────────────────────────────────────────────────────────────
#> ℹ Expression matrix: 6 samples, 4 variables
#> ℹ Sample information fields: condition and batch
#> ℹ Variable information fields: protein, peptide, and glycan_composition
# Rename columns in variable information tibble
rename_var(toy_exp, composition = glycan_composition)
#>
#> ── Experiment ──────────────────────────────────────────────────────────────────
#> ℹ Expression matrix: 6 samples, 4 variables
#> ℹ Sample information fields: group and batch
#> ℹ Variable information fields: protein, peptide, and composition