Skip to contents

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.

Usage

rename_obs(exp, ...)

rename_var(exp, ...)

Arguments

exp

An experiment().

...

<data-masking> Name pairs to rename. Use new_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