abundance_byyr: Create tables of abundance and basal area by year.

Description Usage Arguments Details Value See Also Examples

View source: R/byyr.R

Description

Usage

1
2
3

Arguments

vft

A ForestGEO-like dataframe; particularly a ViewFullTable. As such, it should contain columns PlotName, CensusID, TreeID, StemID, Status, DBH, Genus, SpeciesName, ExactDate, PlotCensusNumber, Family, Tag, and HOM. ExactDate should contain dates from 1980-01-01 to the present day in the format yyyy-mm-dd.

...

Expressions to pick main stems of a specific dbh range (e.g. DBH >= 10 or DBH >= 10, DBH < 20, or DBH >= 10 & DBH < 20).

Details

You don't need to pick stems by status before feeding data to these functions. Doing so may make your code more readable but it should not affect the result. This is because the expressions passed to ... pick data by dbh and exclude the missing dbh values associated to non-alive stems, including dead, missing, and gone stems.

Value

A dataframe.

See Also

fgeo.tool::pick_main_stem().

Other functions for abundance and basal area: abundance()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
library(fgeo.tool)

# Example data
vft <- tibble(
  PlotName = c("luq", "luq", "luq", "luq", "luq", "luq", "luq", "luq"),
  CensusID = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L),
  TreeID = c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L),
  StemID = c(1.1, 1.2, 2.1, 2.2, 1.1, 1.2, 2.1, 2.2),
  Status = c(
    "alive", "dead", "alive", "alive", "alive", "gone",
    "dead", "dead"
  ),
  DBH = c(10L, NA, 20L, 30L, 20L, NA, NA, NA),
  Genus = c("Gn", "Gn", "Gn", "Gn", "Gn", "Gn", "Gn", "Gn"),
  SpeciesName = c("spp", "spp", "spp", "spp", "spp", "spp", "spp", "spp"),
  ExactDate = c(
    "2001-01-01", "2001-01-01", "2001-01-01", "2001-01-01",
    "2002-01-01", "2002-01-01", "2002-01-01",
    "2002-01-01"
  ),
  PlotCensusNumber = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L),
  Family = c("f", "f", "f", "f", "f", "f", "f", "f"),
  Tag = c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L),
  HOM = c(130L, 130L, 130L, 130L, 130L, 130L, 130L, 130L)
)

vft

abundance_byyr(vft, DBH >= 10, DBH < 20)

abundance_byyr(vft, DBH >= 10)

basal <- basal_area_byyr(vft, DBH >= 10)
basal

# Skip R CMD check for speed

measurements_is_installed <- requireNamespace("measurements", quietly = TRUE)
if (measurements_is_installed) {
  # Convert units
  years <- c("yr_2001", "yr_2002")
  basal_he <- basal %>%
    purrr::modify_at(
      years,
      ~ measurements::conv_unit(.x, from = "mm2", to = "hectare")
    )
  basal_he

  # Standardize
  number_of_hectares <- 50
  basal_he %>%
    purrr::map_at(years, ~ .x / number_of_hectares)
}

fgeo.analyze documentation built on Dec. 5, 2020, 9:06 a.m.