Add biomass.

add_biomass(data, species, site, dbh_unit = guess_dbh_unit(data$dbh),
  biomass_unit = "kg")

add_component_biomass(data, species, site,
  dbh_unit = guess_dbh_unit(data$dbh), biomass_unit = "kg")

Arguments

data

A dataframe as those created with add_equations().

species

A ForestGEO-like species-dataframe.

site

The name of the site. One of allodb::sites_info$site.

dbh_unit

Character string giving the unit of dbh values, e.g. "mm" (see valid_units()).

biomass_unit

Character string giving the output unit e.g. "kg".

Value

A dataframe with a single row by each value of rowid.

Examples

library(dplyr)
#> #> Attaching package: ‘dplyr’
#> The following object is masked from ‘package:testthat’: #> #> matches
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
data <- fgeo.biomass::scbi_tree1 %>% slice(1:500) species <- fgeo.biomass::scbi_species add_biomass(data, species, site = "scbi")
#> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`. #> ℹ biomass values are given in [kg]. #> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`. #> ✔ Matching equations by site and species. #> ✔ Refining equations according to dbh. #> ✔ Using generic equations where expert equations can't be found.
#> Warning: Can't find equations matching these species: #> ulmus sp, unidentified unk
#> Warning: Can't find equations for 358 rows (inserting `NA`).
#> Warning: Detected a single stem per tree. Do you need a multi-stem table?
#> Warning: * For trees, `biomass` is that of the main stem.
#> Warning: * For shrubs, `biomass` is that of the entire shrub.
#> ✔ Adding new columns: #> rowid, species, site, biomass
#> # A tibble: 500 x 24 #> rowid treeID stemID tag StemTag sp quadrat gx gy DBHID CensusID #> <int> <int> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <int> <int> #> 1 1 1 1 10079 1 libe 0104 3.70 73 1 1 #> 2 2 2 2 10168 1 libe 0103 17.3 58.9 3 1 #> 3 3 3 3 10567 1 libe 0110 9 197. 5 1 #> 4 4 4 4 12165 1 nysy 0122 14.2 428. 7 1 #> 5 5 5 5 12190 1 havi 0122 9.40 436. 9 1 #> 6 6 6 6 12192 1 havi 0122 1.30 434 13 1 #> 7 7 7 7 12212 1 unk 0123 17.8 447. 15 1 #> 8 8 8 8 12261 1 libe 0125 18 484. 17 1 #> 9 9 9 9 12456 1 vipr 0130 18 598. 19 1 #> 10 10 10 10 12551 1 astr 0132 5.60 628. 22 1 #> # … with 490 more rows, and 13 more variables: dbh <dbl>, pom <chr>, hom <dbl>, #> # ExactDate <chr>, DFstatus <chr>, codes <chr>, nostems <dbl>, date <dbl>, #> # status <chr>, agb <dbl>, species <chr>, site <chr>, biomass <dbl>
# Otputs one row per biomass component add_component_biomass(data, species, site = "scbi") %>% filter(rowid == "131") %>% select(rowid, treeID, stemID, dbh, matches("anatomic_relevance"), biomass)
#> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`. #> ℹ biomass values are given in [kg]. #> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`.
#> Warning: Detected a single stem per tree. Do you need a multi-stem table?
#> Warning: * For trees, `biomass` is that of the main stem.
#> Warning: * For shrubs, `biomass` is that of the entire shrub.
#> # A tibble: 2 x 6 #> rowid treeID stemID dbh anatomic_relevance biomass #> <int> <int> <int> <dbl> <chr> <dbl> #> 1 131 131 131 79.1 foliage total 0.357 #> 2 131 131 131 79.1 branches (live, dead) 1.54
# Sums biomass across components add_biomass(data, species, site = "scbi") %>% filter(rowid == "131") %>% select(rowid, treeID, stemID, dbh, biomass)
#> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`. #> ℹ biomass values are given in [kg]. #> ✔ Guessing dbh in [mm]. #> ℹ You may provide the dbh unit manually via the argument`dbh_unit`.
#> Warning: Detected a single stem per tree. Do you need a multi-stem table?
#> Warning: * For trees, `biomass` is that of the main stem.
#> Warning: * For shrubs, `biomass` is that of the entire shrub.
#> ✔ Adding new columns: #> rowid, species, site, biomass
#> # A tibble: 1 x 5 #> rowid treeID stemID dbh biomass #> <int> <int> <int> <dbl> <dbl> #> 1 131 131 131 79.1 1.90