For a matrix, computes the ratios of the supplied margin (1 = rows, 2 = cols). Otherwise, computes the ratios of the elements.

pairwise_ratios(x, ..., f = `/`, filter = TRUE, set_names = TRUE, sep = ":")

pairwise_ratios.default(x, f = `/`, filter = TRUE, set_names = TRUE, sep = ":")

pairwise_ratios.matrix(
  x,
  margin,
  f = `/`,
  filter = TRUE,
  set_names = TRUE,
  sep = ":"
)

pairwise_ratios.otu_table(
  x,
  margin = "taxa",
  f = `/`,
  filter = TRUE,
  sep = ":"
)

pairwise_ratios.phyloseq(x, margin = "taxa", f = `/`, filter = TRUE, sep = ":")

Arguments

x

A vector or matrix

f

Vectorized binary function applied to numerator and denominator

filter

Whether to filter out redundant pairs

set_names

Whether to set names for the pairs

sep

Seperator for pair names

margin

Margin (1 = rows, 2 = cols) of matrix x to compute ratios of

Examples

mat <- seq(10) %>% matrix(nrow = 2)
#> Error in seq(10) %>% matrix(nrow = 2): could not find function "%>%"
rownames(mat) <- paste0('r', seq(2))
#> Error in rownames(mat) <- paste0("r", seq(2)): object 'mat' not found
colnames(mat) <- paste0('c', seq(5))
#> Error in colnames(mat) <- paste0("c", seq(5)): object 'mat' not found
pairwise_ratios(mat, 2)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'pairwise_ratios': object 'mat' not found
pairwise_ratios(mat[1,])
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'pairwise_ratios': object 'mat' not found