subset_samples_pq: Subset samples using a conditional boolean vector.

View source: R/dada_phyloseq.R

subset_samples_pqR Documentation

Subset samples using a conditional boolean vector.

Description

lifecycle-experimental

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 phyloseq-class object obtained using the phyloseq package.

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")


adrientaudiere/MiscMetabar documentation built on Oct. 13, 2024, 9:42 p.m.