TwoValDiameterCor: Correction of 2 diameter values

View source: R/TwoValDiameterCor.R

TwoValDiameterCorR Documentation

Correction of 2 diameter values

Description

Correction of 2 diameter values

Usage

TwoValDiameterCor(
  DataTree,
  Data,
  DBHCor,
  Time,
  CorrectionType = NULL,
  PositiveGrowthThreshold = 5,
  NegativeGrowthThreshold = -2,
  DBHRange,
  MinIndividualNbr,
  OtherCrit,
  DetectOnly = FALSE
)

Arguments

DataTree

A dataset corresponding to a single tree/stem's (1 IdTree/IdStem) measurements (data.table) If 'phylogenetic hierarchical' correction is asked, the dataset must contain the columns:

  • IdStem or IdTree(character)

  • ScientificNameCor (character)

  • GenusCor (character)

  • FamilyCor (character)

  • Diameter (numeric)

  • Year (numeric)

Data

Complete dataset (data.table) The dataset must contain the columns:

  • IdStem or IdTree (character)

  • ScientificNameCor (character)

  • GenusCor (character)

  • FamilyCor (character)

  • Diameter (numeric)

  • Year (numeric)

DBHCor

Diameter vector in cm (numeric)

Time

Time vector in years (numeric)

CorrectionType

Possible values:

  • NULL: The 1st non-NA diameter value is assigned to the 2nd non-NA diameter value

  • "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.

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)

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. 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)

DetectOnly

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

Value

List of 2 objects:

  • DBHCor (numeric vector): corrected by the method

  • DataTree (data.table): with the DiameterCorrectionMeth column filled with correction method.

Examples

library(data.table)
data(TestData)

DataTree <- TestData[IdTree %in% "100771"]
DataTree <- DataTree[order(Year)] # order de dt

DataTree$Diameter <- c(NA, 13, NA, 8, NA)

DBHCor <- DataTree$Diameter
Time <- DataTree$Year

TwoValDiameterCor(DataTree,
                  Data = TestData,
                  DBHCor, Time,
                  CorrectionType = "phylogenetic hierarchical",
                  DBHRange = 10,
                  MinIndividualNbr = 1, OtherCrit = NULL)


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