calc_prop_taxa_from_sample_type: Calculate the proportion of taxa in a set of samples that are...

View source: R/misc_analyses.R

calc_prop_taxa_from_sample_typeR Documentation

Calculate the proportion of taxa in a set of samples that are also observed in another sample type

Description

Calculate the mean proportion of taxa (i.e. OTUs) in a set of samples that are also observed in another sample type. One use of this function is to get a rough sense of how likely a potential source is contributing to the compostion of another sample type.

Usage

calc_prop_taxa_from_sample_type(
  input,
  type_header,
  primary_type,
  source_type,
  within_cat
)

Arguments

input

The input dataset as loaded by load_taxa_table.

type_header

The header label from the metadata map that has the labels which indicate the types of samples you want to use.

primary_type

The sample type for which you would like to calculate the proportion of taxa that are also observed in the source_type.

source_type

The sample type to use as the source type.

within_cat

[OPTIONAL] Specify a header label from the metadata map that tells the function to restrict pairs to within levels of this factor. If included, will return a data frame instead of a vector.

See Also

calc_prop_shared_taxa

Examples

# proportion of taxa on strawberries that were also found on spinach
calc_prop_taxa_from_sample_type(
  fruits_veggies, type_header = 'Sample_type', primary_type = 'Strawberries',
  source_type = 'Spinach'
)
# proportion of taxa on strawberries that were also found on spinach within
# each farming type
calc_prop_taxa_from_sample_type(
  fruits_veggies, type_header = 'Sample_type', primary_type = 'Strawberries',
  source_type = 'Spinach', within_cat = 'Farm_type'
)

leffj/mctoolsr documentation built on Aug. 5, 2022, 1:27 a.m.