The function returns two groups situated in the low and high quantile of the given metadata item. When two metadata items are provided, three splitting modi are available: congruent, complementary and inverse. For groups with low and high values of a metadata item and two metadata items, congruent means that the low group is low for both metadata items and the high group is high for both metadata items, inverse means that the low group is low for the first metadata item and high for the second metadata item and vice versa for the high group whereas congruent means that the first group is high for the first metadata item and the second high for the second metadata item.

selectSamplesGivenMetadata(
  abundances,
  metadata,
  metadata.name = "",
  metadata2.name = "",
  mode = "congruent",
  quantile.def = c(0.1, 0.9)
)

Arguments

abundances

a matrix with taxa as rows and samples as columns

metadata

a dataframe with metadata items as columns

metadata.name

the name of a numeric metadata item to be used for sample splitting

metadata2.name

the name of a second numeric metadata item to be used for sample splitting

mode

the splitting mode; can be inverse, complementary or congruent; only relevant if a second metadata item is provided

quantile.def

the thresholds on the lower and upper quantile which define the two sample groups (group 1 from 0 to first quantile, group 2 from second quantile to 1)

Value

The function returns the abundances of group 1 and 2 (named group1 and group2) as well as the group-specific metadata values (named metadata1 and metadata2), where second metadata item values can be empty.