prop_abund | R Documentation |
Calculates proportional abundance of each species (columns) across samples (rows) in community data matrix m. Row sums of output matrix will all be 1.
prop_abund(
m,
to_int = FALSE,
max_int = floor(sqrt(.Machine$integer.max)),
speciesRows = FALSE
)
m |
matrix or data frame of numeric values. Columns represent species, rows are samples. |
to_int |
logical. Should output matrix be transformed into integers from 0 to max_int? Integers take up half as much space as doubles, and as weights are equivalent for calculating specificity. The tradeoff is a little bit of precision (default: FALSE). |
max_int |
integer. Maximum integer value used for to_int. If pairwise geometric means will be calculated with these data, it is nice to keep this value as the square root of the maximum integer size, which is the default. |
speciesRows |
logical. Do rows represent species (instead of samples)? (default:FALSE) |
matrix of proportional abundances.
John L. Darcy
# library(specificity)
# attach(endophyte)
# m_dbl <- prop_abund(otutable)
# m_int <- prop_abund(otutable, to_int=TRUE)
# head(rowSums(m_dbl))
# head(rowSums(m_int))
# # note that they are off by a little bit. This small loss in precision is OK.
# object.size(m_dbl)
# object.size(m_int)
# random_positions <- random_rep_positions(m_dbl, 100)
# plot(m_int[random_positions] ~ m_dbl[random_positions])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.