knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(lfcdata)

Allometries database

The Spanish National Forest Inventory and the Catalonia Forest and Ecology Inventory contain enough data to provide allometries for the most common forestry variables. This database offers the allometries calculated at CREAF and CTFC research centers.
In the database they are also included allometries provided by the Spanish National Agricultural Research Insitute and the ones provided by Montero et al. and de Caceres et al. papers.

To access the allometries use the allometries() function:

allomdb <- allometries()
allomdb

All allometries are presented in one table, with their main characteristics:

allom_table <- allometries_get_data(allomdb)
allom_table

Main characteristics

allometries_get_data(allomdb, 'thesaurus_cubication') |>
  dplyr::select(cubication_shape_id, description = translation_eng)

Describing the variables (allometries_describe_var)

allometries_describe_var(allomdb, c('DBH', 'DR'))

Inspecting an allometry (allometries_description)

  1. By allometry id
bh_287 <- allometries_description(allomdb, id = 'BH_287')
bh_287$BH_287$equation
bh_287$BH_287$source
  1. By allometries characteristics
allom_list <- allometries_description(allomdb, dependent_var %in% c("GC", "BH"))
length(allom_list)
allom_list[[1]]$equation
allom_list[[900]]$equation
  1. All the allometries

We can obtain the same information as with allometries_get_data, but in a nested list format by no providing id or ... arguments:

allom_list <- allometries_description(allomdb)
length(allom_list)
allom_list[[1]]$equation

Calculate values based on an allometry

Allometries in the database can be used right away with the allometries_calculate function (see ?allometries_calculate). Vectors with the independent variables values must be supplied, as well as the allometry identificator.

allometry_info <- allometries_description(
  allomdb,
  spatial_level_name == 'Alt Camp',
  functional_group_level_name == 'Ilex aquifolium',
  dependent_var == 'BH'
)
allometry_info$BH_287$independent_var_1
allometries_calculate(allomdb, DR = c(5.5, 4.6, 3.7), allometry_id = "BH_287")

It can be used inside in combination with dplyr:

library(dplyr)
dummy_data <- data.frame(
  branch_diameter = c(5.5, 4.6, 3.7)
)

dummy_data |>
  mutate(
    leaves_biomass = allometries_calculate(
      allomdb, DR = branch_diameter, allometry_id = 'BH_287'
    )
  )


MalditoBarbudo/lfcdata documentation built on May 2, 2023, 10:30 p.m.