metacoder (version 0.1.3)

filter_obs: Filter observations with a list of conditions

Description

Filter observations in a taxmap object with a list of conditions. Any column name that appears in obs_data(.data) can be used as if it was a vector on its own. See filter for inspiration and more information.

Usage

filter_obs(.data, ..., unobserved = TRUE)

Arguments

.data
...

One or more filtering conditions. This can be one of two things:

integer

One or more indexes of obs_data

logical

A TRUE/FALSE vector of length equal to the number of rows in obs_data

Any column name that appears in obs_data(.data) can be used as if it was a vector on its own.

unobserved

(logical of length 1) If TRUE, preserve taxa even if all of their observations are filtered out. If FALSE, remove taxa for which all observations were filtered out. Note that only taxa that are unobserved due to this filtering will be removed; there might be other taxa without observations to begin with that will not be removed.

Value

An object of type taxmap

See Also

Other dplyr-like functions: arrange_obs, arrange_taxa, filter_taxa, mutate_obs, mutate_taxa, sample_frac_obs, sample_frac_taxa, sample_n_obs, sample_n_taxa, select_obs, select_taxa, transmute_obs, transmute_taxa

Examples

Run this code
# NOT RUN {
# Filter by sequence name, but preserve all taxa
filter_obs(unite_ex_data_3, grepl("Lachnum", seq_name))
# Filter by sequence name and only keep taxa with sequences that pass the filter
filter_obs(unite_ex_data_3, grepl("Lachnum", seq_name), unobserved = FALSE)

# }

Run the code above in your browser using DataCamp Workspace