DiameterCorrectionByTree: DiameterCorrectionByTree

View source: R/DiameterCorrection.R

DiameterCorrectionByTreeR Documentation

DiameterCorrectionByTree

Description

DiameterCorrectionByTree

Usage

DiameterCorrectionByTree(
  DataTree,
  Data,
  DefaultHOM = 1.3,
  MaxDBH = 500,
  PositiveGrowthThreshold = 5,
  NegativeGrowthThreshold = -2,
  Pioneers = NULL,
  PioneersGrowthThreshold = 7.5,
  WhatToCorrect = c("POM change", "punctual", "shift"),
  CorrectionType = "individual",
  DBHRange = 10,
  MinIndividualNbr = 5,
  OtherCrit = NULL,
  Digits = 1L,
  coef = 0.9,
  DetectOnly = FALSE
)

Arguments

DataTree

A dataset corresponding to a single tree/stem's (1 IdTree/IdStem) measurements (data.frame or data.table).

Data

Complete dataset (data.table) used if the "phylogenetic hierarchical" correction (CorrectionType argument) is chosen. The dataset must contain the columns:

  • IdStem or IdTree (character)

  • ScientificNameCor (character)

  • GenusCor (character)

  • FamilyCor (character)

  • Diameter (numeric)

  • Year (numeric)

DefaultHOM

Default Height Of Measurement in meter (Default: 1.3 m) (numeric, 1 value)

MaxDBH

Maximum possible DBH of your stand in cm (numeric, 1 value)

PositiveGrowthThreshold

in cm/year: a tree widening by more than x cm/year is considered abnormal (numeric, 1 value)

NegativeGrowthThreshold

in cm/census: the possible positive measurement error (+n) cannot be corrected until the growth appears abnormal, but a negative measurement error can be allowed until -n (a tree does not decrease). Thus the positive measurement error (+n) is "compensated". (numeric, 1 value)

Pioneers

Scientific names of the pioneer species of the site, as in the 'ScientificNameCor' column (characters vector)

PioneersGrowthThreshold

in cm/year: a tree of a pioneer species that widens by more than x cm/year is considered abnormal (numeric, 1 value)

WhatToCorrect

c("POM change", "punctual", "shift") (character)

  • "POM change": detect POM change in the column 'POM' and correct the Diameter values from it.

  • "punctual": detect if the error is punctual and correct it by interpolation.

  • "shift": detect if there is a shift of several 'Diameter' values and links them to the trust measurements set.

CorrectionType

Possible values: "individual", "phylogenetic hierarchical" (character).

  • "individual": replace abnormal growth by interpolation from the individual values.

  • "phylogenetic hierarchical": replace abnormal growth with the average growth of other trees in the dataset, at the specific, genus, family or stand level, within a DBH range of x cm (DBHRange argument). If the number of these trees < n (MinIndividualNbr argument) at the specific level, we switch to the genus level etc.

DBHRange

DBH range in cm to take into account to select other trees in the dataset to apply "phylogenetic hierarchical" correction (Default: 10 cm) (numeric, 1 value)

MinIndividualNbr

Minimum number of individuals to take into account in "phylogenetic hierarchical" correction (Default: 5) (numeric, 1 value)

OtherCrit

Other criteria to select the individuals used for the calculation of the mean growth in the "phylogenetic hierarchical" correction. Give the name of the column(s) for which the individuals must have the same value as the tree to correct (e.g. c("Plot", "Subplot")) (character)

Digits

Number of decimal places to be used in the 'DBHCor' column (Default: 1L) (integer)

coef

description... (numeric)

DetectOnly

TRUE: Only detect errors, FALSE: detect and correct errors (Default: FALSE) (logical)

Details

When there is only 1 Diameter value for a tree/stem, DBHCor takes the original Diameter value. If this value is 0 or > MaxDBH, DBHCor takes NA.

Value

Fill the Comment column with error type informations. If DetectOnly = FALSE, add columns:

  • DBHCor: corrected trees diameter at default HOM

  • DiameterCorrectionMeth = "local linear regression"/"weighted mean"/phylogenetic hierarchical("species"/"genus"/"family"/"stand")/"shift realignment"/"Same value".

Examples

library(data.table)
data(TestData)

 DataTree <- data.table(IdStem = "c",
      ScientificName = "A",
      Year = c(seq(2000,2008, by = 2), 2012, 2014,2016, 2020), # 9 Diameter values
      Diameter = c(13:16, 16-4, (16-4)+2, (16-4)+3, 15-4, (15-4)+2), # 0.5 cm/year
      POM = as.factor(c(0, 0, 0, 0, 1, 1, 1, 2, 2)))

Rslt <- DiameterCorrectionByTree(
  DataTree, TestData,
  WhatToCorrect = c("POM change", "punctual", "shift"),
  CorrectionType = c("linear", "individual")
  )
setnames(Rslt, "POMCor", "POM_TreeDataCor")
DiameterCorrectionPlot(Rslt, CorCol = "DBHCor")


VincyaneBadouard/TreeData documentation built on Jan. 4, 2024, 2:56 a.m.