phy_add_metadata_variables: Add metadata variables to a phyloseq

View source: R/phy_add_metadata_variables.R

phy_add_metadata_variablesR Documentation

Add metadata variables to a phyloseq

Description

Adds a set of metadata variables to the metadata of a phyloseq object. Make sure 'rownames' contain the same names. Row ordering is taken care of internally

Usage

phy_add_metadata_variables(physeq, df, by, verbose = FALSE)

Arguments

physeq

A 'phyloseq' object

df

A 'data.frame' object, with rownames matching 'sample_names' of the 'phyloseq' object

by

A 'character' containing the variable to merge the two 'sample_data' by.

verbose

Should the function tell you the missing samples?

Examples

data(GlobalPatterns)
df_test <- data.frame(variable_new = rnorm(n = nsamples(GlobalPatterns), mean = 2, sd = 0.8))
rownames(df) <- samples_names(GlobalPatterns)
phy_add_metadata_variables(physeq=GlobalPatterns,
                           df = df_test)


g-antonello/gautils2 documentation built on Nov. 28, 2022, 9:39 a.m.