density_ind: Create a vector of wood density for each individual tree...

Description Usage Arguments Details Value Examples

Description

Create a vector of wood density for each individual tree based on the species name and plot.

Usage

1
density_ind(df, plot, wsgdata, denscol = "wsg")

Arguments

df

The table of individuals; must include a dbh and a species name, the latter named sp.

plot

Character string giving the name of the plot where the data comes from (as it appears in the names of the R Analytical Tables).

wsgdata

A table of wood density; this table must have columns:

  • sp with species names,

  • plot;

  • wsg the wood density (the name of this column can be changed using the argument denscol). The CTFS wood-density table has this structure, but any table with those columns will work. If a species in the df table has a matching species name in the correct plot, its wood density is taken.

denscol

Name of the column in wsgdata containing wood density data.

Details

If a species is not found in the correct plot, then the mean wood density of all species in the same plot is taken. The function fails (returns only NAs) if there are no entries for the selected plot in the wood-density table.

Name density.ind clashed with an S3 method, so it was replaced by density_ind.

Value

A vector of wood density of the same size as the df table submitted.

If you need a dummy wood density table to feed the wsg argument see wsgdata_dummy().

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
wooddens = density_ind(df = bciex::bci12t1mini,
  plot = "bci",
  wsg = wsg.ctfs2
)
mean(wooddens, na.rm = TRUE)
length(which(is.na(wooddens)))

## End(Not run)

forestgeo/ctfs documentation built on May 3, 2019, 6:44 p.m.