Description Usage Arguments Value Examples
This function calculates metric scores based on a Thresholds data frame. Can generate scores for 1/3/5 (ScoreRegime="135") or 0-100 (ScoreRegime="100").
1 | metric.score(MetricName, MetricValue, IndexName, IndexRegion, Thresh)
|
MetricName |
metric abbreviation |
MetricValue |
calculated metric value |
IndexName |
name of index (e.g., MBSS.2005.Bugs) |
IndexRegion |
relevant bioregion or site class for given index |
Thresh |
Data frame of Scoring Thresholds (Index.Name, Index.Region, Metric, Direction, Thresh.Lo, Thresh.Hi, ScoreRegime) |
vector of scores
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Load thresholds
thresh <- metrics_scoring
View(thresh)
## Define Index
IndexName <- "MBSS.2005.Bugs"
## Score Single Value
MetricName <- "nt_total"
MetricValue <- 18
IndexRegion <- "CP"
metric.score(MetricName,MetricValue,IndexName,IndexRegion,thresh)
## Score Data Frame of Values
# get metrics to score
myMetrics <- as.character(droplevels(unique(thresh[thresh[,"Index"]==IndexName,"Metric"])))
for (i in myMetrics){##FOR.i.START
i.sc.nam <- paste0("Sc_",i)
i.val <- Metrics.Bugs[,i]
Metrics.Bugs[,i.sc.nam] <- metric.score(i,i.val,Metrics.Bugs$Index,Metrics.Bugs$Region,thresh)
#
}##FOR.i.END
#
## View Results
View(Metrics.Bugs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.