prep.common.vars.fun: Function to Calculate Common Variables

Description Usage Arguments Details Value Author(s) Examples

View source: R/PrepCommonVars.R

Description

A function to calculate common variables needed to estimate growth, death, etc.

Usage

1
2
prep.common.vars.fun(tr, fl, i.period, this.period, common.vars, vars.required,
period.length, ...)

Arguments

tr

A trList class object.

fl

A list describing the plot data.

i.period

The number of period (from 0 to nperiods) for which to calculate the comon variables.

this.period

The period for which to calculate the common variables.

common.vars

A list with existing common variables.

vars.required

Variables to be calculated.

period.length

Length of the periods, in years.

...

Details

This is an example of a prep.common.vars file. A prep.common.vars (prepare common variables) is needed for the simulation. It is in this file that additional variables needed for the particular functions used in the simulation are calculated. For example, to calculate quadratic mean diameter, basal area, or volume.

Value

A list

res

A list with the common variables.

fl

Updated fl

Author(s)

Clara Anton Fernandez [email protected]

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
foo.matrix <-  matrix(0, nrow = length(tr$dbh), ncol = (5 +1))
colnames(foo.matrix) <- paste("t", 0:5, sep = "")
foo.dbh <- foo.height <- foo.matrix
foo.dbh[,1] <- tr$dbh
foo.height[,1] <- tr$height

trl <- list(
  plot.id  = tr$plot.id,
  treeid    = tr$treeid,
  dbh.mm    = foo.dbh,
  height.dm = foo.height,
  yrs.sim   = rep(0, nrow(tr)),
  tree.sp   = factor(tr$tree.sp)
)
tr.i <- trList$new(data = trl, nperiods = as.integer(5))

common.vars <-  prep.common.vars.fun(
  tr = tr.i,
  fl = fl,
  i.period       = 0,
  this.period    = "t0",
  common.vars    = "NULL",
  vars.required  = c("vol.wo.tr.m3.ha", "vuprha.m3.h"),
  period.length = 5,
  species.spruce = c(1, 2, 3),
  species.pine = c(10, 11, 20, 21, 29),
  species.harw = c(30, 31)
)
str(common.vars)

sitree documentation built on July 5, 2017, 9:02 a.m.