Keep or remove samples using values from a column in sample_info.
Usage
filter_samples_by_group(object, group_by, groups, keep = TRUE, na_keep = FALSE)
Arguments
- object
A microbiome_dataset object.
- group_by
A column in sample_info.
- groups
Character vector of group labels used for filtering.
- keep
Should the provided groups be kept? Defaults to TRUE.
- na_keep
Should samples with missing group values be kept? Defaults to
FALSE.
Value
A microbiome_dataset object.
Examples
data("global_patterns", package = "microbiomedataset")
x <- filter_samples_by_group(
global_patterns,
group_by = "SampleType",
groups = c("Soil", "Ocean")
)
dim(x@expression_data)
#> [1] 19216 6