subset_samples_pq {MiscMetabar} | R Documentation |
Subset samples using a conditional boolean vector.
Description
The main objective of this function is to complete the
phyloseq::subset_samples()
function by propose a more easy
(but more prone to error) way of subset_samples.
It replace the subsetting expression which used the name of the variable
in the sam_data by a boolean vector.
Warnings: you must verify the result of this function as the
boolean condition must match the order of samples in the sam_data
slot.
This function is robust when you use the sam_data slot of the phyloseq object used in physeq (see examples)
Usage
subset_samples_pq(physeq, condition)
Arguments
physeq |
(required): a |
condition |
A boolean vector to subset samples. Length must fit the number of samples |
Value
a new phyloseq object
Examples
cond_samp <- grepl("A1", data_fungi@sam_data[["Sample_names"]])
subset_samples_pq(data_fungi, cond_samp)
subset_samples_pq(data_fungi, data_fungi@sam_data[["Height"]] == "Low")
[Package MiscMetabar version 0.9.1 Index]