Description Usage Arguments Details Value Examples
Split metrics into BCG levels for calibration
1 | split_mets(met_in, splt, bcgs, both = FALSE)
|
met_in |
input |
splt |
|
bcgs |
|
both |
logical if a |
The inputs for splt
and bcgs are separate lists where each element is named as a metric in met_in
. Numeric values for for each elemene tin splt
must be monotonic in the range from and including zero to one. These values are converted to the scale of each metric for assigning BCG levels. Numeric values in each element of bcgs
are the BCG levels assigned to each split in splt
, with total length of each element equal to the length of each element in splt
- 1.
This is splitting into definite, crisp intervals (no fuzzy logic).
A data.frame
with metric values converted to BCG levels. This will have the same dimensions as met_in
unless both = TRUE
. NA
values are returned for non-unique metrics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library(dplyr)
# get metrics, number of metrics, and number of bcg levels
met_in <- get_stony_mets(crl_dem)
nmets <- ncol(met_in) - 1
nbcgs <- 4
# setup splits, these may differ by metric
splt <- rep(seq(0, 1, length = nbcgs + 1), times = nmets) %>%
matrix(nrow = nbcgs + 1) %>%
data.frame %>%
as.list
names(splt) <- names(met_in)[-1]
# setup bcg levels, one minus splts, reverse for bleached, diseased
# this approach can include non-monotonic change
bcgs <- rep(seq(nbcgs + 1, 2), times = nmets) %>%
matrix(ncol = nmets) %>%
data.frame
names(bcgs) <- names(met_in)[-1]
bcgs[, names(bcgs) %in% c('bleached', 'diseased')] <- seq(2, nbcgs + 1)
bcgs <- as.list(bcgs)
split_mets(met_in, splt = splt, bcgs = bcgs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.