get_variable: Get the values for a particular variable in sample_data

Description Usage Arguments Value See Also Examples

View source: R/almostAllAccessors.R

Description

This is a simple accessor function for streamlining access to values/vectors/factors/etc contained in the sample_data.

Usage

1
get_variable(physeq, varName)

Arguments

physeq

(Required). sample_data-class, or phyloseq-class.

varName

(Required). Character string of the variable name in sample_data. Use sample_variables(physeq) for available variables in your object.

Value

Data. The clas of the data depends on what the contents of sample_data.

See Also

get_taxa taxa_names sample_names

sample_variables

Examples

1
2
3
4
# Load the GlobalPatterns dataset into the workspace environment
data(GlobalPatterns)
# Look at the different values for SampleType 
get_variable(GlobalPatterns, "SampleType")

Example output

 [1] Soil               Soil               Soil               Feces             
 [5] Feces              Skin               Skin               Skin              
 [9] Tongue             Tongue             Freshwater         Freshwater        
[13] Freshwater (creek) Freshwater (creek) Freshwater (creek) Ocean             
[17] Ocean              Ocean              Sediment (estuary) Sediment (estuary)
[21] Sediment (estuary) Feces              Feces              Mock              
[25] Mock               Mock              
9 Levels: Feces Freshwater Freshwater (creek) Mock ... Tongue

phyloseq documentation built on Nov. 8, 2020, 6:41 p.m.