Learn R Programming

fgeo.analyze (version 1.1.14)

recruitment_ctfs: Recruitment, mortality, and growth.

Description

These functions are adapted from the CTFS-R package. Compared to the original functions, these ones have a similar interface but use more conservative defaults and allow suppressing messages. These functions also feature formal tests, bug fixes, additional assertions, and improved messages.

Usage

recruitment_ctfs(
  census1,
  census2,
  mindbh = NULL,
  alivecode = NULL,
  split1 = NULL,
  split2 = NULL,
  quiet = FALSE
)

mortality_ctfs( census1, census2, alivecode = NULL, split1 = NULL, split2 = NULL, quiet = FALSE )

growth_ctfs( census1, census2, rounddown = FALSE, method = "I", stdev = FALSE, dbhunit = "mm", mindbh = NULL, growthcol = "dbh", err.limit = 1000, maxgrow = 1000, split1 = NULL, split2 = NULL, quiet = FALSE )

Arguments

census1, census2

Two census tables, each being a ForestGEO-like tree table (dataframe). A stem table won't fail, but you should use a tree table because demography analyses make more sense at the scale of trees than at the scale of stems.

mindbh

The minimum diameter above which the counts are done. Trees smaller than mindbh are excluded. By default all living trees of any size are included.

alivecode

Character; valid values of status indicating that a tree is alive. The default, 'A', is the standard CTFS designation for living trees or stems.

split1, split2

Optional vector(s) to aggregate results by. Each vector should be a column of either census1 or census2. The default aggregates the result across the entire census datasets.

quiet

Use TRUE to suppress messages.

rounddown

If TRUE, all dbh < 55 are rounded down to the nearest multiple of 5.

method

Either "I" or "E":

  • Use "I" to calculate annual dbh increment as (dbh2 - dbh1)/time

  • Use "E" to calculate the relative growth rate as (log(dbh2) - log(dbh1)) / time

stdev

Logical:

  • FALSE returns confidence limits.

  • TRUE returns the SD in growth rate per group.

dbhunit

"cm" or "mm".

growthcol

Either "dbh" or "agb" to define how growth is measured.

err.limit, maxgrow

A number. Numbers such as 10000 are high and will return all measures.

Value

Metrics of recruitment: Similar to metrics of mortality.

Metrics of mortality:

  • N: the number of individuals alive in the census 1 per category selected.

  • D: the number of individuals no longer alive in census 2.

  • rate: the mean annualized mortality rate constant per category selected, calculated as (log(N)-log(S))/time.

  • upper: upper confidence limit of mean rate.

  • lower: lower confidence limit of mean rate.

  • time: mean time interval in years.

  • date1: mean date included individuals were measured in census 1, as julian object (R displays as date, but treats as integer).

  • date2: mean date in census 2.

  • dbhmean: mean dbh in census 1 of individuals included.

Metrics of growth:

  • rate, the mean annualized growth rate per category selected, either dbh increment, or relative growth.

  • N, the number of individuals included in the mean (not counting any excluded).

  • clim (or sd with stdev = TRUE), width of confidence interval; add this number to the mean rate to get upper confidence limit, substract to get lower.

  • dbhmean, mean dbh in census 1 of individuals included.

  • time, mean time interval in years.

  • date1, mean date included individuals were measured in census 1, as julian object (R displays as date, but treats as integer).

  • date2, mean date in census 2.

Details

Survivors are all individuals alive in both censuses, with status == A in the first census, and a diameter greater than mindbh in the first census. The total population in the second census includes all those alive plus any other survivors. Individuals whose status is NA in either census are deleted from all calculations.

Examples

Run this code
# NOT RUN {
assert_is_installed("fgeo.x")

census1 <- fgeo.x::tree5
census2 <- fgeo.x::tree6

as_tibble(
  recruitment_ctfs(census1, census2)
)

# Use `interaction(...)` to aggregate by any number of grouping variables
sp_quadrat <- interaction(census1$sp, census1$quadrat)

recruitment <- recruitment_ctfs(
  census1, census2,
  split1 = sp_quadrat,
  quiet = TRUE
)
as_tibble(recruitment)

mortality <- mortality_ctfs(
  census1, census2,
  split1 = sp_quadrat, quiet = TRUE
)
as_tibble(mortality)

growth <- growth_ctfs(census1, census2, split1 = sp_quadrat, quiet = TRUE)
as_tibble(growth)

# Easy way to separate grouping variables
tidyr_is_installed <- requireNamespace("tidyr", quietly = TRUE)
if (tidyr_is_installed) {
  library(tidyr)

  as_tibble(growth) %>%
    separate(groups, into = c("sp", "quadrat"))
}
# }

Run the code above in your browser using DataLab