Title

compute_rates(
  data,
  status_col = "status_corr",
  time_col = ifelse(is.null(getOption("time_col")), "CensusYear",
    getOption("time_col")),
  id_col = ifelse(is.null(getOption("id_col")), "idTree", getOption("id_col")),
  dead_confirmation_censuses = 2,
  byplot = TRUE,
  plot_col = ifelse(is.null(getOption("plot_col")), "Plot", getOption("plot_col")),
  corrected = TRUE
)

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.

status_col

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

time_col

character, name of the column containing census years.

id_col

character, name of the column containing trees unique IDs.

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.

byplot

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

plot_col

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

corrected

Logical, indicates whether the dataset has been corrected (for tree status errors) beforehand. If TRUE, triggers correct_alive, defaults to TRUE.

Value

a data.frame that contains recruitment and mortality rates, in the same format as the outputs of compute_mortality and compute_recruitment

Examples

data(example_status_corr) suppressWarnings( compute_rates(example_status_corr))
#> interval time plot annual_recruitment_rate annual_deathrate #> 1 1984_1985 1985 1 0.024120603 0.007157464 #> 2 1985_1986 1986 1 0.004040404 0.009045226 #> 3 1985_1987 1987 3 0.120950606 0.011976480 #> 4 1986_1987 1987 1 0.010121457 0.012121212 #> 5 1987_1988 1988 1 0.006085193 0.008097166 #> 6 1987_1989 1989 3 0.125722360 0.012089801 #> 7 1988_1989 1989 1 0.007128310 0.011156187 #> 8 1989_1990 1990 1 0.006147541 0.012219959 #> 9 1989_1991 1991 3 0.155352221 0.010061151 #> 10 1990_1991 1991 1 0.016210740 0.005122951 #> 11 1991_1992 1992 1 0.004065041 0.007092199 #> 12 1991_1993 1993 3 0.154704243 0.007901098 #> 13 1992_1993 1993 1 0.008113590 0.006097561 #> 14 1993_1994 1994 1 0.002038736 0.007099391 #> 15 1993_1995 1995 3 0.079471941 0.008884420 #> 16 1994_1995 1995 1 0.011190234 0.009174312 #> 17 1995_1997 1997 1 0.119340337 0.007146595 #> 18 1995_1997 1997 3 0.104370715 0.022355139 #> 19 1997_1999 1999 1 0.179424522 0.010739253 #> 20 1997_1999 1999 3 0.239982547 0.009852457 #> 21 1999_2001 2001 1 0.064051262 0.011637128 #> 22 1999_2001 2001 3 0.144714921 0.010526609