correct_all performs corrections for tree life status, overgrown recruits cases, size measurement errors and POM changes, by calling correct_alive, correct_size and correct_recruits in this order.

correct_all(
  data,
  id_col = getOption("id_col"),
  time_col = getOption("time_col"),
  status_col = getOption("status_col"),
  plot_col = getOption("plot_col"),
  byplot = TRUE,
  dead_confirmation_censuses = 2,
  use_size = FALSE,
  invariant_columns = c("Genus", "Species", "binomial_name", "Forest", "Family"),
  size_col = getOption("size_col"),
  species_col = "binomial_name",
  POM_col = getOption("POM_col"),
  measure_type = getOption("measure_type"),
  positive_growth_threshold = 5,
  negative_growth_threshold = -2,
  default_POM = 1.3,
  pioneers = c("Cecropia", "Pourouma"),
  pioneers_treshold = 7.5,
  dbh_min = 10
)

Arguments

data

data.frame, containing forest inventories in the form of a long-format time series - one line corresponds to a measurement for one individual at a given census time.

id_col

character, name of the column containing trees unique IDs.

time_col

character, name of the column containing census years.

status_col

character, name of the column corresponding to tree status: 0/FALSE for dead, 1/TRUE for alive.

plot_col

character, name of the column containing plot indices or names.

byplot

logical, indicating whether the function has to process the data by plot (TRUE)or for the whole dataset (FALSE).

dead_confirmation_censuses

integer, defaults to 2: number of consecutive censuses for which a tree is unseen that are needed to consider the tree as dead. NB: for the trees unseen during the dead_confirmation_censuses -1 last inventories, the status cannot be corrected, thus mortality rates should not be calculated for these censuses.

use_size

character, defaults to FALSE. Optional argument specifying whether to use measurement column (circumference or diameter) to create a vital status field in case it does not already exist. See Details.

invariant_columns

character vector, containing the name of the columns for which value remain constant for a given tree (for example species name or coordinates). When a row is added by the function correct_alive, values for invariant columns are taken from the value for other censuses. Defaults to null

size_col

character, name of the column corresponding to tree size (circumference or diameter) measurements .

species_col

character, name of th column containing full species names (or other taxonomic identification)

POM_col

character, name of the column corresponding the Point Of Measurement (POM).

measure_type

character, partially matching “Circumference” or “Diameter”, indicating what is the type of the measurements.

positive_growth_threshold

positive numeric or integer, threshold over which an annual DIAMETER growth is considered abnormal (in cm). Defaults to 5 cm.

negative_growth_threshold

negative numeric or integer, threshold under which an absolute DIAMETER difference is considered abnormal. To be given in centimeters. Defaults to -2 cm. Note that this threshold is applied between two consecutive censuses, regardless of the time between them, as it assumes that a tree diameter cannot decrease more than this value, even over a long period.

default_POM

scalar numeric, default POM used in the dataset, in the same unit as the POM. When the value in POM_col is different from default_POM, the corrected size is given at default_POM . It defaults to 1.3 meters-according to current practice of measurement of diameter at breast height (DBH).

pioneers

character vector containing full species name (or other taxonomic identification)for which a specific positive growth threshold (used for instance for fast growing species for which the threshold to detect an abnormal growth is high).

pioneers_treshold

Positive DIAMETER growth limit to apply to pioneer species (specified in 'pioneers'), similar to . Expressed in centimeters. Defaults to 7.5 cm

dbh_min

scalar integer or numeric, indicating the minimum DIAMETER (in centimeters) at the default measurement height from which trees are recorded. Defaults to 10 cm.

Value

A data.frame with additional columns: status_corr and size_corr for corrected tree vital status and size, code_corr for correction tag and types.

Examples

data(example_census) # Short version: parameters specified using prepare_forestdata and default values prepare_forestdata(example_census, plot_col="Plot", id_col="idTree", time_col="CensusYear", status_col = "CodeAlive", size_col="Circ", measure_type = "C", POM_col = "POM")
#> [1] "plot_col let to its default or previous value" #> [1] "id_col let to its default or previous value" #> [1] "time_col let to its default or previous value" #> [1] "status_col let to its default or previous value" #> [1] "size_col let to its default or previous value" #> [1] "measure_type let to its default or previous value" #> [1] "POM_col let to its default or previous value"
all_cors <- suppressWarnings(correct_all(example_census, invariant_columns = c("Genus", "Species", "binomial_name", "Forest", "Family"), species_col = "binomial_name",#tag pioneer measure_type = getOption("measure_type"), pioneers = c("Cecropia","Pourouma"),#tag pioneer pioneers_treshold = 7.5))
#> | | | 0% | |=================================== | 50% | |======================================================================| 100% #> | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |== | 4% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========= | 14% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================ | 24% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |===================== | 31% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================= | 34% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================ | 41% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |============================== | 44% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |=================================== | 51% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |===================================== | 54% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================ | 64% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |=================================================== | 74% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |======================================================== | 81% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |========================================================== | 84% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |=============================================================== | 91% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================= | 94% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100% #> | | | 0% | |=================================== | 50% | |======================================================================| 100%
# Full call: all_cors <- suppressWarnings(correct_all(example_census, id_col = "idTree", time_col = "CensusYear", status_col = "CodeAlive", plot_col = "Plot", byplot = TRUE, dead_confirmation_censuses = 2, use_size = FALSE, invariant_columns = c("Genus", "Species", "binomial_name", "Forest", "Family"), size_col = "Circ", species_col = "binomial_name",#tag pioneer POM_col = "POM", measure_type = "C", positive_growth_threshold = 5, negative_growth_threshold = -2, default_POM = 1.3, pioneers = c("Cecropia","Pourouma"),#tag pioneer pioneers_treshold = 7.5, dbh_min = 10))
#> | | | 0% | |=================================== | 50% | |======================================================================| 100% #> | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 2% | |== | 3% | |== | 4% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |===== | 6% | |===== | 7% | |===== | 8% | |====== | 8% | |====== | 9% | |======= | 9% | |======= | 10% | |======= | 11% | |======== | 11% | |======== | 12% | |========= | 12% | |========= | 13% | |========= | 14% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 16% | |============ | 17% | |============ | 18% | |============= | 18% | |============= | 19% | |============== | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |=============== | 22% | |================ | 22% | |================ | 23% | |================ | 24% | |================= | 24% | |================= | 25% | |================== | 25% | |================== | 26% | |=================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |===================== | 31% | |====================== | 31% | |====================== | 32% | |======================= | 32% | |======================= | 33% | |======================= | 34% | |======================== | 34% | |======================== | 35% | |========================= | 35% | |========================= | 36% | |========================== | 36% | |========================== | 37% | |========================== | 38% | |=========================== | 38% | |=========================== | 39% | |============================ | 39% | |============================ | 40% | |============================ | 41% | |============================= | 41% | |============================= | 42% | |============================== | 42% | |============================== | 43% | |============================== | 44% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 46% | |================================= | 47% | |================================= | 48% | |================================== | 48% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |=================================== | 51% | |==================================== | 51% | |==================================== | 52% | |===================================== | 52% | |===================================== | 53% | |===================================== | 54% | |====================================== | 54% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 56% | |======================================== | 57% | |======================================== | 58% | |========================================= | 58% | |========================================= | 59% | |========================================== | 59% | |========================================== | 60% | |========================================== | 61% | |=========================================== | 61% | |=========================================== | 62% | |============================================ | 62% | |============================================ | 63% | |============================================ | 64% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |=============================================== | 67% | |=============================================== | 68% | |================================================ | 68% | |================================================ | 69% | |================================================= | 69% | |================================================= | 70% | |================================================= | 71% | |================================================== | 71% | |================================================== | 72% | |=================================================== | 72% | |=================================================== | 73% | |=================================================== | 74% | |==================================================== | 74% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 76% | |====================================================== | 77% | |====================================================== | 78% | |======================================================= | 78% | |======================================================= | 79% | |======================================================== | 79% | |======================================================== | 80% | |======================================================== | 81% | |========================================================= | 81% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |========================================================== | 84% | |=========================================================== | 84% | |=========================================================== | 85% | |============================================================ | 85% | |============================================================ | 86% | |============================================================= | 86% | |============================================================= | 87% | |============================================================= | 88% | |============================================================== | 88% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |=============================================================== | 91% | |================================================================ | 91% | |================================================================ | 92% | |================================================================= | 92% | |================================================================= | 93% | |================================================================= | 94% | |================================================================== | 94% | |================================================================== | 95% | |=================================================================== | 95% | |=================================================================== | 96% | |==================================================================== | 96% | |==================================================================== | 97% | |==================================================================== | 98% | |===================================================================== | 98% | |===================================================================== | 99% | |======================================================================| 99% | |======================================================================| 100% #> | | | 0% | |=================================== | 50% | |======================================================================| 100%
str(all_cors)
#> 'data.frame': 25684 obs. of 16 variables: #> $ Forest : chr "Paracou:P6" "Paracou:P6" "Paracou:P6" "Paracou:P6" ... #> $ Plot : chr "1" "1" "1" "1" ... #> $ idTree : int 100621 100621 100621 100621 100621 100621 100621 100621 100621 100621 ... #> $ Family : chr "Euphorbiaceae" "Euphorbiaceae" "Euphorbiaceae" "Euphorbiaceae" ... #> $ Genus : chr "Sandwithia" "Sandwithia" "Sandwithia" "Sandwithia" ... #> $ Species : chr "guyanensis" "guyanensis" "guyanensis" "guyanensis" ... #> $ CensusYear : int 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 ... #> $ CodeAlive : logi TRUE TRUE TRUE TRUE TRUE TRUE ... #> $ CodeMeas : int 0 0 0 0 0 0 0 0 0 0 ... #> $ Circ : num 40 40 40 40.5 40.5 41.5 40.5 40.5 40.5 41 ... #> $ binomial_name : chr "Sandwithia_guyanensis" "Sandwithia_guyanensis" "Sandwithia_guyanensis" "Sandwithia_guyanensis" ... #> $ POM : num 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 1.3 ... #> $ status_corr : num 1 1 1 1 1 1 1 1 1 1 ... #> $ code_corr : chr "0" "0" "0" "0" ... #> $ size_corr : num 40 40 40 40.5 40.5 41.5 40.5 40.5 40.5 41 ... #> $ corrected_recruit: logi FALSE FALSE FALSE FALSE FALSE FALSE ...