Macroinvertebrate Metrics
Source:vignettes/macroinvertebrate-metrics.Rmd
macroinvertebrate-metrics.Rmd
Welcome
This document has been created following the generic assessment guidance.
Description
Basic details about the assessment. Update the ‘response’ values as required.
question | response |
---|---|
name_short | Macroinvertebrate Metrics |
name_long | Freshwater Macroinvertebrate Metrics |
parameter | River Invertebrates |
status | prototype |
type | metric |
Input
A list of questions required to run the assessment.
question | response |
---|---|
Taxon abundance | 12 |
Live abundance | 12 |
Assessment
If applicable, write a function to assess your input data and return an outcome. For example, a metric, statistic, prediction etc.
assessment_function <- function(data, ...) {
# Calculated invert metrics...
# Note, any non-standard base R library must be call using require().
require(dplyr)
require(whpt)
require(macroinvertebrateMetrics)
input <- data
input$label <- trimws(input$label)
input <- dplyr::filter(
input,
parameter %in% c(
"River Family Inverts",
"BANKSIDE_INVERTS"
)
)
input <- dplyr::filter(input, question %in% c(
"Taxon abundance",
"Live abundance"
))
if(nrow(input) < 1) {
return(NULL)
}
input <- ungroup(input)
input <- dplyr::select(
input, "sample_id", "question", "response", "label", "parameter"
)
output <- macroinvertebrateMetrics::calc_metric(input)
# riverfly <- macroinvertebrateMetrics::calc_riverfly(input)
# output <- dplyr::bind_rows(whpt, riverfly)
output <- dplyr::select(
output, "sample_id", "question", "response"
)
names(output) <- c("sample_id", "question", "response")
return(output)
}
Outcome
The outcome of your assessment.
#> Loading required package: whpt
#>
#> Attaching package: 'whpt'
#> The following object is masked from 'package:hera':
#>
#> demo_data
#> Loading required package: macroinvertebrateMetrics
#>
#> Attaching package: 'macroinvertebrateMetrics'
#> The following object is masked from 'package:whpt':
#>
#> demo_data
#> The following object is masked from 'package:hera':
#>
#> demo_data
question | response |
---|---|
EPSI Score TL2 | 100 |
EPSI Condition TL2 | Minimally sedimented/unsedimented |
PSI Score TL3 | 100 |
PSI Condition TL3 | Minimally sedimented/unsedimented |
Riverfly Score | 2 |
Riverfly NTAXA | 1 |
Riverfly ASPT | 2 |
SPEAR ratio TL2 | 100 |
SPEAR toxic ratio TL2 | -12.7607142857143 |
SPEAR class TL2 | High |
WHPT_SCORE | 5.9 |
WHPT_ASPT | 5.9 |
WHPT_NTAXA | 1 |
WHPT_P_SCORE | 5.5 |
WHPT_P_ASPT | 5.5 |
WHPT_P_NTAXA | 1 |
Check
Run checks on the assessment.
#> Test passed 🥇
#> Test passed 🎊
check | value |
---|---|
standard_names | TRUE |
standard_required | TRUE |
standard_required_values | TRUE |
Update
Update the catalogue of assessments to make them available.
#> ✔ Setting active project to "/home/runner/work/hera/hera".
#> ✔ Saving "catalogue" to "data/catalogue.rda".
#> ☐ Document your data (see <https://r-pkgs.org/data.html>).
After updating the catalogue, rebuild the package, click on Build > Install and Restart menu or ‘Install and Restart’ button in the Build pane.