aggregate_specs_list: aggregate_specs_list

Description Usage Arguments Value Author(s) Examples

View source: R/aggregate_specs_list.r

Description

Aggregates a list of outputs from specificity::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.

Usage

1
aggregate_specs_list(sl, byFeature = FALSE, fd = NULL, fd_id = 1)

Arguments

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).

Value

a data.frame object.

Author(s)

John L. Darcy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# attach(antarctica)
# # to see details of the antarctica data set, see ?antarctica
# # aggregate data long format:
# ant_long <- aggregate_specs_list(antarctica_specs_list, byFeature=FALSE,
#   fd=antarctica_taxonomy, fd_id=1)
# head(ant_long)
# ant_wide <- aggregate_specs_list(antarctica_specs_list, byFeature=TRUE,
#   fd=antarctica_taxonomy, fd_id=1)
# head(ant_wide)
# # aggregation can also be done without feature data (fd):
# ant_long <- aggregate_specs_list(antarctica_specs_list, byFeature=FALSE)
# head(ant_long)
# ant_wide <- aggregate_specs_list(antarctica_specs_list, byFeature=TRUE)
# head(ant_wide)

darcyj/specificity.shiny documentation built on Dec. 19, 2021, 8:11 p.m.