knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  echo = FALSE
)
library(hera)
library(dplyr)
library(purrr)
library(tidyr)
library(tibble)
library(magrittr)
library(testthat)
library(visNetwork)

Welcome

This document has been created following the generic assessment guidance.

Description

Basic details about the assessment. Update the 'response' values as required.

description <- tribble(
  ~question, ~response,
  "name_short", "TDI",
  "name_long", "Example",
  "parameter", "River Diatoms",
  "status", "prototype"
)

description

Input

A list of questions required to run the assessment.

input <- tibble(
  location_id = c("8175", "8175"),
  sample_id = c("12345", "12345"),
  date_taken = c("2019-11-21", "2019-11-21"),
  question = c("Taxon abundance", "Alkalinity"),
  response = c("12", "45"),
  label = c("Gomphonema olivaceum", NA),
  parameter = c("River Diatoms", "Chemistry"),
  type = c("number", "number"),
  max = c(NA, NA),
  min = c(NA, NA),
  source = c("sepa_ecology_results", "location_attributes")
)
input

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 some statistic...
  # Note, any non-standard base R library must be call using require().
  # require(dplyr)
  # require(tidyr)
  # require(magrittr)
  # require(tibble)
  # data <- data %>%
  #   group_by(sample_id) %>% 
  #   summarise(question = "n_count",
  #             response = n(),
  #             sample_id = unique(sample_id)
  #             )

  return(data)
}

Outcome

The outcome of your assessment.

outcome <- assessment_function(input)
outcome

Check

Run checks on the assessment.

# No need to edit this code
# Format description
standard_format <- hera:::hera_format(description = description) 
# Check description
check_list <- hera:::hera_test(description = description)
knitr::kable(check_list$standard_check)

Update

Update the catalogue of assessments to make them available.

# No need to edit this code
hera:::update_catalogue(
  description = description,
  input = input,
  assessment_function = assessment_function,
  output = outcome
)

After updating the catalogue, rebuild the package, click on Build > Install and Restart menu or 'Install and Restart' button in the Build pane.

Test

This section tests if this assessment is usable using assessment function.

# No need to edit this code
assess(
  data = hera::demo_data,
  name = description$response[description$question == "name_long"]
)

Launch app

Below is an interactive application displaying the results of your assessment.

# No need to edit this code
# launch_app(new_catalogue = catalogue, data = data)


ecodata1/hera documentation built on April 5, 2025, 1:48 a.m.