## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(openNCAI)

## ----show-hab-tree-snippet----------------------------------------------------
ns_display_habitats_label_tree[1:3]

## ----demo-manual-tree-input---------------------------------------------------
my_hab_tree <- list(
  "Woodlands" = c("Deciduous woodland",
                 "Evergreen woodland", 
                 "Scrub woodland"),
  "Coastal" = c("Dunes and sandy shores",
               "Shingle")
) 

## ----show-es-tree-snippet-----------------------------------------------------
ns_display_es_label_tree[1:3]

## ----show-ci-list-------------------------------------------------------------
ns_display_ci_names[1:4]

## ----demo-manual-cilist-inpu--------------------------------------------------
my_ci_list <- c("Bathing water quality index", "Forestry yield", "Woodland bird count")

## ----show-year-list-----------------------------------------------------------
my_num_year_list <- 2000:2022

## ----create-blank-template, eval = FALSE--------------------------------------
# create_ncai_template(template_out = "Blank_NS_Data_Entry_Template.xlsx",
#                      habitats_label_tree = ns_display_habitats_label_tree,
#                      es_label_tree = ns_display_es_label_tree,
#                      ci_names = ns_display_ci_names,
#                      year_list = my_num_year_list)

## ----read-complete-template, eval = FALSE-------------------------------------
# ncai_data_objects <- read_ncai_template(
#   path = "Complete_NS_Data_Entry_Template.xlsx",
#   habitats_label_tree = ns_display_habitats_label_tree,
#   es_label_tree = ns_display_es_label_tree,
#   ci_names = ns_display_ci_names)

## ----list-read-template-outputs, eval = FALSE---------------------------------
# names(ncai_data_objects)

## ----show-one-template-output, eval = FALSE-----------------------------------
# ncai_data_objects$clean_habitats_label_tree

## ----read-ncai-template-outputs, echo = FALSE---------------------------------
read_outputs <- data.frame(
  `Object Name` = c(
    "clean_habitats_label_tree",
    "clean_es_label_tree",
    "habitat_extent",
    "ci_scores",
    "provision_per_unit_scores",
    "between_importance",
    "within_importance",
    "indicator_directory",
    "ci_relevance_matrices"
  ),
  `Description` = c(
    "Cleaned version of the habitats label tree.",
    "Cleaned version of the ecosystem service label tree.",
    "Habitat areas over time.",
    "Condition indicator scores over time.",
    "Provision-per-unit scores, denoting relative capacity of habitats to provide ecosystem services.",
    "Importance scores for each ecosystem service type.",
    "Importance scores for individual ecosystem services within each type group.",
    "Table recording the salience of each condition indicator in representing flow of services of each SEEA type.",
    "Binary relevance matrices for every condition indicator, recording for which habitat/ecosystem service combinations that indicator is relevant."
  ),
  `Data Format` = c(
    "A named list of character vectors.",
    "A named list of character vectors.",
    "A data frame where rows are habitats and columns are years.",
    "A data frame where rows are years and columns are condition indicators.",
    "A data frame where rows are habitats and columns are ecosystem services.",
    "A named list of numeric values.",
    "A nested list of named lists.",
    "A data frame with a column for condition indicator names, and a column for each of the ecosystem service types.",
    "A named list of data frames (one per indicator)."
  ),
  check.names = FALSE
)

knitr::kable(read_outputs)

