RecruitmentCorrectionByTree: RecruitmentCorrectionByTree

View source: R/RecruitmentCorrection.R

RecruitmentCorrectionByTreeR Documentation

RecruitmentCorrectionByTree

Description

RecruitmentCorrectionByTree

Usage

RecruitmentCorrectionByTree(
  DataTree,
  MinDBH = 10,
  PositiveGrowthThreshold = 5,
  InvariantColumns = c("Site", "GenusCor", "SpeciesCor", "FamilyCor",
    "ScientificNameCor"),
  PlotCensuses,
  DetectOnly = FALSE
)

Arguments

DataTree

A dataset corresponding to a single tree's (1 IdTree/Idstem) measurements (data.frame or data.table). The dataset should preferably contain the column of corrected diameters: 'Diameter_TreeDataCor', otherwise the function will take the column "Diameter"

MinDBH

Minimum diameter of trees inventoried according to your protocol (in cm) (numeric, 1 value)

PositiveGrowthThreshold

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

InvariantColumns

Vector with the names of the columns that are supposed to have always the same value for each measurement of the same tree (character)

PlotCensuses

Census years for the plot in which the tree is (integer)

DetectOnly

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

Details

If the size of the tree has never changed, or if there is only one value the same value is kept for the added forgotten recruits. If the Diameter has not been corrected (Diameter_TreeDataCor column does not exist), the function will create it for the forgotten recruits. It is strongly recommended to correct the Diameter before correcting the recruits.

Value

Add rows for forgotten recruits with them estimated DBH in the 'Diameter_TreeDataCor' column, create a 'CorrectedRecruit' column (logical) and fill the 'Comment' column : "This DBH is/was the 1st recorded for this tree, according to its annual growth and the census done for this plot, it should have been recruited earlier according to your protocol (MinDBH)."

Examples

library(data.table)
DataTree <- data.table(IdTree = "a",
                       Year = seq(2000,2008, by = 2), # 2 years/census
                       Diameter_TreeDataCor  = as.numeric(c(13:17)), # 1cm/census(0.5 cm/year)
                       Site = "Imaginary forest"
)
# 1st DBH = 13 > MinDBH. In 1998 the tree was 12cm, 11cm in 1996 and 10cm in
1994.
Rslt <- RecruitmentCorrectionByTree(DataTree,
                                    InvariantColumns = "Site",
                                    PlotCensuses = seq(1996,2016, by = 2))


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