View source: R/make_measurement_table.R
| make_measurement_table | R Documentation |
Compiles the table of numerical measurements used to estimate sizes and fit
allometric models. The table is built entirely from the data you supply:
every row with a numerical size_col is kept (expanded by abundance so
each row represents one individual), carrying its taxonomy along.
make_measurement_table(dats, level_vec)
dats |
Dataframe to be used for estimation. |
level_vec |
Vector of taxonomic levels to be used in the measurement table. |
A table with measurements and taxonomy, ready to be used for size and biomass estimation.
# Reference measurements for one family, renamed to the columns the package expects
measurements <-
bromeliad_inverts_measurements() %>%
dplyr::filter(family == "Culicidae") %>%
dplyr::rename(size_col = body_size_mm,
biomass_col = body_mass_mg,
biomass_type = mass_type) %>%
dplyr::mutate(size_col = as.character(size_col),
biomass_col = as.numeric(biomass_col))
# Taxa to estimate, with no measurement of their own
communities <-
trini_communities() %>%
dplyr::filter(family == "Culicidae") %>%
dplyr::rename(abundance = n) %>%
dplyr::mutate(size_col = "unknown",
biomass_col = NA,
biomass_type = "dry")
# The two together are what the package works on
dats <-
combine_measurements(dats = communities, measurements = measurements)
level_vec <-
c("species", "genus", "family")
# One row per measured individual, taxonomy carried along
make_measurement_table(dats = dats, level_vec = level_vec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.