calc_obs_props | R Documentation |
For a given table in a taxmap
object, convert one or more
columns containing counts to proportions. This is meant to be used with
counts associated with observations (e.g. OTUs), as opposed to counts that
have already been summed per taxon.
calc_obs_props(
obj,
data,
cols = NULL,
groups = NULL,
other_cols = FALSE,
out_names = NULL,
dataset = NULL
)
obj |
A |
data |
The name of a table in |
cols |
The columns in
|
groups |
Group multiple columns per treatment/group. This should be a
vector of group IDs (e.g. character, integer) the same length as
|
other_cols |
Preserve in the output non-target columns present in the input data. New columns will always be on the end. The "taxon_id" column will be preserved in the front. Takes one of the following inputs:
|
out_names |
The names of count columns in the output. Must be the same
length and order as |
dataset |
DEPRECIATED. use "data" instead. |
A tibble
Other calculations:
calc_diff_abund_deseq2()
,
calc_group_mean()
,
calc_group_median()
,
calc_group_rsd()
,
calc_group_stat()
,
calc_n_samples()
,
calc_prop_samples()
,
calc_taxon_abund()
,
compare_groups()
,
counts_to_presence()
,
rarefy_obs()
,
zero_low_counts()
## Not run:
# Parse data for examples
x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
class_regex = "^(.+)__(.+)$")
# Calculate proportions for all numeric columns
calc_obs_props(x, "tax_data")
# Calculate proportions for a subset of columns
calc_obs_props(x, "tax_data", cols = c("700035949", "700097855", "700100489"))
calc_obs_props(x, "tax_data", cols = 4:6)
calc_obs_props(x, "tax_data", cols = startsWith(colnames(x$data$tax_data), "70001"))
# Including all other columns in ouput
calc_obs_props(x, "tax_data", other_cols = TRUE)
# Inlcuding specific columns in output
calc_obs_props(x, "tax_data", cols = c("700035949", "700097855", "700100489"),
other_cols = 2:3)
# Rename output columns
calc_obs_props(x, "tax_data", cols = c("700035949", "700097855", "700100489"),
out_names = c("a", "b", "c"))
# Get proportions for groups of samples
calc_obs_props(x, "tax_data", groups = hmp_samples$sex)
calc_obs_props(x, "tax_data", groups = hmp_samples$sex,
out_names = c("Women", "Men"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.