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.
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 )
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 |
alivecode | Character; valid values of |
split1, split2 | Optional vector(s) to aggregate results by. Each vector
should be a column of either |
quiet | Use |
rounddown | If |
method | Either "I" or "E":
|
stdev | Logical:
|
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. |
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.
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.
Richard Condit, Suzanne Lao.
assert_is_installed("fgeo.x") census1 <- fgeo.x::tree5 census2 <- fgeo.x::tree6 as_tibble( recruitment_ctfs(census1, census2) )#>#> #> #>#> # A tibble: 1 x 8 #> N2 R rate lower upper time date1 date2 #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 29 3 0.0241 0.00846 0.0681 4.53 18938. 20601.# 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)#> # A tibble: 540 x 9 #> groups N2 R rate lower upper time date1 date2 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 MATDOM.1007 1 0 0 0 0.410 4.50 18891 20535 #> 2 CASSYL.1010 1 0 0 0 0.411 4.49 18914 20555 #> 3 SLOBER.110 1 0 0 0 0.409 4.51 18897 20543 #> 4 SLOBER.1106 1 0 0 0 0.404 4.56 18849 20516 #> 5 CECSCH.1114 1 0 0 0 0.413 4.47 18948 20580 #> 6 PSYBRA.1318 1 0 0 0 0.412 4.48 19011 20646 #> 7 HIRRUG.1403 1 0 0 0 0.403 4.58 18834 20506 #> 8 CASSYL.1411 1 0 0 0 0.414 4.45 18931 20558 #> 9 SLOBER.1414 1 0 0 0 0.403 4.57 18952 20622 #> 10 GUAGUI.1419 1 0 0 0 0.406 4.54 19012 20670 #> # … with 530 more rowsmortality <- mortality_ctfs( census1, census2, split1 = sp_quadrat, quiet = TRUE ) as_tibble(mortality)#> # A tibble: 540 x 10 #> groups N D rate lower upper time date1 date2 dbhmean #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 MATDOM.1007 1 0 0 0 0.410 4.50 18891 20535 240 #> 2 CASSYL.1010 1 0 0 0 0.411 4.49 18914 20555 67 #> 3 SLOBER.110 1 0 0 0 0.409 4.51 18897 20543 150 #> 4 SLOBER.1106 1 0 0 0 0.404 4.56 18849 20516 50 #> 5 CECSCH.1114 1 0 0 0 0.413 4.47 18948 20580 228 #> 6 PSYBRA.1318 1 0 0 0 0.412 4.48 19011 20646 14 #> 7 HIRRUG.1403 1 0 0 0 0.403 4.58 18834 20506 12.9 #> 8 CASSYL.1411 1 0 0 0 0.414 4.45 18931 20558 13.1 #> 9 SLOBER.1414 1 0 0 0 0.403 4.57 18952 20622 16.6 #> 10 GUAGUI.1419 1 0 0 0 0.406 4.54 19012 20670 108 #> # … with 530 more rows#> # A tibble: 540 x 8 #> groups rate N clim dbhmean time date1 date2 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 MATDOM.1007 0 1 NA 240 4.50 18891 20535 #> 2 CASSYL.1010 0.445 1 NA 67 4.49 18914 20555 #> 3 SLOBER.110 0.666 1 NA 150 4.51 18897 20543 #> 4 SLOBER.1106 0 1 NA 50 4.56 18849 20516 #> 5 CECSCH.1114 1.79 1 NA 228 4.47 18948 20580 #> 6 PSYBRA.1318 0.447 1 NA 14 4.48 19011 20646 #> 7 HIRRUG.1403 1.66 1 NA 12.9 4.58 18834 20506 #> 8 CASSYL.1411 NA 0 NA NA NA NA NA #> 9 SLOBER.1414 1.40 1 NA 16.6 4.57 18952 20622 #> 10 GUAGUI.1419 NA 0 NA NA NA NA NA #> # … with 530 more rows# 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")) }#> # A tibble: 540 x 9 #> sp quadrat rate N clim dbhmean time date1 date2 #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 MATDOM 1007 0 1 NA 240 4.50 18891 20535 #> 2 CASSYL 1010 0.445 1 NA 67 4.49 18914 20555 #> 3 SLOBER 110 0.666 1 NA 150 4.51 18897 20543 #> 4 SLOBER 1106 0 1 NA 50 4.56 18849 20516 #> 5 CECSCH 1114 1.79 1 NA 228 4.47 18948 20580 #> 6 PSYBRA 1318 0.447 1 NA 14 4.48 19011 20646 #> 7 HIRRUG 1403 1.66 1 NA 12.9 4.58 18834 20506 #> 8 CASSYL 1411 NA 0 NA NA NA NA NA #> 9 SLOBER 1414 1.40 1 NA 16.6 4.57 18952 20622 #> 10 GUAGUI 1419 NA 0 NA NA NA NA NA #> # … with 530 more rows