
Select columns of the sample or variable information tibble
select_obs.RdThese two functions provide a way to trimming down the sample or variable information tibble
of an experiment() to only the columns of interest.
The same syntax as dplyr::select() is used.
For example, to get a new experiment() with only the "sample" and "group"
columns in the sample information tibble,
use select_obs(exp, group).
Note that you don't need to (and you can't) explicitly select or deselect the
sample column in sample_info.
It is automatically handled by select_obs(), always being selected.
The same applies to the variable column in var_info.
Arguments
- exp
An
experiment().- ...
<
data-masking> Column names to select. If empty, all columns except thesampleorvariablecolumn will be discarded.
Value
An new experiment() object.
Details
When using select_var() with dplyr, you may encounter package conflicts.
dplyr also has a function called select_var() that has been deprecated for over two years.
If you encounter package conflicts, use the following code to resolve them:
conflicted::conflicts_prefer(glyexp::select_var)Examples
library(magrittr)
toy_exp <- toy_experiment
toy_exp_2 <- toy_exp %>%
select_obs(group) %>%
select_var(protein, peptide)
#> Error in select_var(., protein, peptide): unused argument (peptide)
get_sample_info(toy_exp_2)
#> Error: object 'toy_exp_2' not found
get_var_info(toy_exp_2)
#> Error: object 'toy_exp_2' not found