View source: R/aggregate_specs_list.r
aggregate_specs_list | R Documentation |
Aggregates a list of outputs from phy_or_env_spec() into a single data.frame object. Can also include feature data (e.g. species taxonomy) into that output. Output can also be byFeature, with one row per feature, and multiple columns for different variables.
aggregate_specs_list(sl, byFeature = FALSE, fd = NULL, fd_id = 1)
sl |
specs_list. A named list of outputs from phy_or_env_spec. See examples. |
byFeature |
bool. If true, each feature will occupy only one row, with multiple columns to represent the different variables in specs_list (default: FALSE) |
fd |
data.frame. Optional feature data - a data.frame object with one row per feature, including some column with feature IDs that includes feature IDs in sl as rownames (default:NULL) |
fd_id |
integer or string. If integer, specifies the column index of fd that contains feature ids. If character, specifies the column name (default: 1). |
a data.frame object.
John L. Darcy
# attach(endophyte)
# otutable <- occ_threshold(prop_abund(otutable), 20)
# specs_list <- list()
# # note: "index_rough" is only being used here to save time for demonstration purposes.
# specs_list$elevation <- phy_or_env_spec(otutable, env=metadata$Elevation,
# n_cores=20, n_sim=100, denom_type="sim_center")
# specs_list$rainfall <- phy_or_env_spec(otutable, env=metadata$Rainfall,
# n_cores=20, n_sim=100, denom_type="sim_center")
# # aggregate, long mode, like for ggplot:
# specs_df_long <- aggregate_specs_list(specs_list, byFeature=FALSE, fd=taxonomy, fd_id=1)
# # aggregate, wide mode:
# specs_df_wide <- aggregate_specs_list(specs_list, byFeature=TRUE, fd=taxonomy, fd_id=1)
# # example plot with ggplot:
# library(ggplot2)
# ggplot(specs_df_long, aes(x=Variable, y=Spec)) + geom_violin() + geom_jitter(width=0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.