Title

compute_growth(
  data,
  size_col = "Circ",
  measure_type = "cir",
  status_col = "CodeAlive",
  id_col = "idTree",
  time_col = "CensusYear",
  what_output = "annual",
  aggregate = FALSE,
  by = c("Plot", "SubPlot"),
  stat = "mean",
  percentiles = c(5, 95),
  ...
)

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.

size_col

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

measure_type

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

status_col

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

id_col

character, name of the column containing trees unique IDs.

time_col

character, name of the column containing census years.

what_output

character, one of 'annual' or 'absolute'. Defines if the output growth rates must be annualised growth rates or absolute between-census deltas (respectively).

aggregate

logical, defining if the growthrates must be aggregated (TRUE) according to specified variables (argument 'by') with calculated values 'stat' and quantiles ('percentiles'); or returned for each individual (FALSE).

by

character vector, names of the grouping variables used to aggregate values.

stat

character, one of the following: 'mean','sum','median'. Statistics used if values are aggregated.

percentiles

integer vector between 0 and 100. Percentiles are calculated if values are aggegated.

...

Optional arguments for advanced use. ask_stat: logical, defaults to TRUE, if set to FALSE, try directly to use the specified 'stat' for aggregation without checking it -thus, not failproof-.verbose: logical, defaults to TRUE, if set to FALSE or equivalent, show less messages.

Value

Either the input data.frame with individual-level calculated growth rates, or a data.frame with grouping variables and required statistics.

Examples

data(example_census) growth <- suppressWarnings(compute_growth(example_census))
#> The growth rates were not computed when tree life status was 0 (dead) or NA (unseen or uncertain), thus the growth rate on these lines was set to NA
head(growth)
#> Forest Plot id Family Genus Species time status #> 260 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1985 TRUE #> 261 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1986 TRUE #> 262 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1987 TRUE #> 536 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1988 TRUE #> 248 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1989 TRUE #> 537 Paracou:P6 1 100621 Euphorbiaceae Sandwithia guyanensis 1990 TRUE #> CodeMeas size binomial_name POM time_lag id_lag size_lag #> 260 0 40.0 Sandwithia_guyanensis 1.3 1984 100621 40.0 #> 261 0 40.0 Sandwithia_guyanensis 1.3 1985 100621 40.0 #> 262 0 40.5 Sandwithia_guyanensis 1.3 1986 100621 40.0 #> 536 0 40.5 Sandwithia_guyanensis 1.3 1987 100621 40.5 #> 248 0 41.5 Sandwithia_guyanensis 1.3 1988 100621 40.5 #> 537 0 40.5 Sandwithia_guyanensis 1.3 1989 100621 41.5 #> absolute_growth time_interval annual_growth #> 260 0.0 1985 1984 0.0 #> 261 0.0 1986 1985 0.0 #> 262 0.5 1987 1986 0.5 #> 536 0.0 1988 1987 0.0 #> 248 1.0 1989 1988 1.0 #> 537 -1.0 1990 1989 -1.0