Learn R Programming

sitree (version 0.1-15)

height.korf: Simple height function

Description

A simple tree height function based on tree species, and DBH. It returns the difference between the height at the current period (this.period) and the next period.

Usage

height.korf(common.vars, this.period, tr,  dbh.inc.mm, ...)

Value

A vector with tree heights increments in dm.

Arguments

common.vars

A list with at least an element named 'spp' with the species group composition.

this.period

The period for which to calculate the height of the trees.

tr

A trList.

dbh.inc.mm

A vector with the projected dbh increment.

...

Currently not used

Author

Clara Anton Fernandez caf@nibio.no

Examples

Run this code
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,
  this.period    = "t0",
  i.period       = 0,
  common.vars    = "NULL",
  mng.options    = NA,
  vars.required  = c("spp"),
  period.length = 5
)
height.korf(common.vars = common.vars$res, this.period = 't0', 
    tr.i, fl, dbh.inc.mm = runif(nrow(tr.i$data$dbh.mm), 5, 80)) 

Run the code above in your browser using DataLab