Title: | Functions and Datasets for "Forest Analytics with R" |
---|---|
Description: | Provides functions and datasets from the book "Forest Analytics with R". |
Authors: | Andrew Robinson and Jeff Hamann |
Maintainer: | Andrew Robinson <[email protected]> |
License: | GPL-3 |
Version: | 1.1.2 |
Built: | 2024-12-12 06:47:29 UTC |
Source: | CRAN |
This function generates a dataframe object that contains the original stem measurements and appends columns named by log.grades, where log.grades corresponds to the minimum log diameters defined by log.breaks.
generate.log.vols( x, log.breaks=c(2,5,12,18,32,999), log.grades=c("pulp","s4","s3","s2","s1","peeler"), display.stems=FALSE )
generate.log.vols( x, log.breaks=c(2,5,12,18,32,999), log.grades=c("pulp","s4","s3","s2","s1","peeler"), display.stems=FALSE )
x |
The dataframe containing the original stem measurements. |
log.breaks |
The vector defining the minimum diameters for the log grades defined by log.grades. |
log.grades |
The vector defining the text labels for the log.breaks. |
display.stems |
The control switch to display stems as they are being merchanised. |
The function contains supporting function to determine the merchantable stem height, then tallies the amount of Smalian log volume, in each of the log.grades. The resulting dataframe is then converted to be appended to each tree record in x. Normally, it would not be called directly.
A dataframe that contains the original stem measurements with the log volumes appended.
Jeff D. Hamann <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
# test <- data.frame(a = c(1,2), b = c(3,4)) # show.cols.with.na(test) # is.na(test$a[2]) <- TRUE # show.cols.with.na(test)
# test <- data.frame(a = c(1,2), b = c(3,4)) # show.cols.with.na(test) # is.na(test$a[2]) <- TRUE # show.cols.with.na(test)
This function returns a data.frame object that contains several useful column attributes about a linear programming GLPK object.
get.col.report( lp )
get.col.report( lp )
lp |
A GLPK object. |
The function generates a data.frame
object that contains information from a GLPK object.
A data.frame that contains several elements returned from GLPK wrapper functions that return attributes from a column from an GLPK object.
Jeff D. Hamann <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
The GNU GLPK home page at http://www.gnu.org/software/glpk/glpk.html
get.row.report
The function generates a data.frame
object that contains row information from a GLPK object.
get.row.report( lp )
get.row.report( lp )
lp |
A GLPK object. |
The function generates a data.frame
object that contains row information from a GLPK object.
A data.frame that contains several elements returned from GLPK wrapper functions that return attributes from a row from an GLPK object.
Jeff D. Hamann <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
The GNU GLPK home page at http://www.gnu.org/software/glpk/glpk.html
The data are measures from 107 trees. The trees were selected as being of average size from healthy and well stocked stands in the Alps.
data(gutten)
data(gutten)
A data frame with 1200 observations on the following 9 variables.
site
Growth quality class of the tree's habitat. 5 levels.
location
Distinguishes tree location. 7 levels.
tree
An identifier for the tree within location.
age.base
The tree age taken at ground level.
height
Tree height, m.
dbh.cm
Tree diameter, cm.
volume
Tree volume.
age.bh
Tree age taken at 1.3 m.
tree.ID
A factor uniquely identifying the tree.
The data were kindly provided to us by Professor Boris Zeide, and are documented in von Guttenberg, A. R., 1915. Growth and yield of spruce in Hochgebirge. Franz Deuticke, Vienna (in German).
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
Zeide, B., 1993. Analysis of growth equations. Forest Science 39 (3), 549-616
data(gutten) str(gutten)
data(gutten) str(gutten)
These data were collected during the 1994 planting season in Southwest Washington State.
data(herbdata)
data(herbdata)
A data frame with 961 observations on the following 8 variables.
treatment for control or application
replication
tree number in the replication
date the observation was made
indicator for alive/dead status
height of the tree in cm
basal diameter of the stem, in mm
diameter at breast height, in mm
The plots were installed during the 1994 planting season in southwestern Washington by Don Wallace and Bruce Alber. Three replications of 20 seedlings were planted in two blocks. The two blocks were a control block and a block treated with 220 ml per hectare of Oust herbicide. The plots were then measured over the next ten years. At each observation, the basal diameter, total height, and condition of the stem were recorded. When the stems reached breast height (1.37 m in the United States), the breast height diameter was also recorded. An indicator variable was used to record if the stem was dead or alive. If the stem was dead, the observations were recorded as NA.
The data are provided courtesy of Don Wallace and Bruce Alber of the Wilbur-Ellis Company.
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
data(herbdata)
data(herbdata)
This vectorized function uses models and parameter estimates from Wykoff et al. (1982) to predict tree heights given over-bark diameter measurements (cm) taken at 1.37 m (4'6”). The function ht.fvs.ni.ft performs the computation in imperial units, and ht.fvs.ni.m is a wrapper for convenience.
ht.fvs.ni.ft(spp, dbh.in) ht.fvs.ni.m(spp, dbh.cm)
ht.fvs.ni.ft(spp, dbh.in) ht.fvs.ni.m(spp, dbh.cm)
spp |
Tree species. Must be one of: WP, WL, DF, GF, WH, WC, LP, ES, SF, PP, MH |
dbh.cm |
Tree diameter, cm, measured at 1.37 m. from the ground. |
dbh.in |
Tree diameter, in., measured at 1.37 m. from the ground. |
The species are: WP = white pine, WL = western larch, DF = Douglas-fir, GF = grand fir, WH = western hemlock, WC = western red cedar, LP = lodgepole pine, ES = Engelmann spruce, SF = subalpine fir, PP = ponderosa pine, and MH = mountain hemlock.
The function was fitted using least squares regression; the resposne variable was log of height and the predictor variable 1 / (DBH + 1).
The function returns a vector of tree heights, in metres.
The function doesn't perform any input checks. Caveat computator.
Andrew Robinson <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
Wykoff, W. R., Crookston, N. L., Stage, A. R., 1982. User's Guide to the Stand Prognosis Model. GTR-INT 133, USDA Forest Service, Ogden, UT.
ht.fvs.ni.m(c("DF, WH"), c(25, 27))
ht.fvs.ni.m(c("DF, WH"), c(25, 27))
These data are used to present and study forest regulation using mathematical programming and R.
data(leuschner)
data(leuschner)
A data frame with 48 observations on the following 4 variables.
index variable identifying the type of forested area
cutting period of the forest harvest schedule
at harvest at cutting period midpoint of planning period
the stand volume at age, in thousands of cubic feet per acre
This table contains example yields for an 84,000 acre (33993.93 ha) Douglas-fir forest. The yields span over six (6) planning periods and eight (8) age classes from age 25 to 95 years of age.
The data were originally published in Leuschner (1990).
Leuschner, William A. 1990. Forest Regulation, Harvest Scheduling, and Planning Techniques. John Wiley and Sons, Inc.
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
data(leuschner) print( leuschner )
data(leuschner) print( leuschner )
This function reports the number of missing values in each variable in a dataframe. Variables that have no missing values are ignored.
show.cols.with.na(x)
show.cols.with.na(x)
x |
The dataframe to check. |
A vector of missing values counts, one value for each variable with missing values. If no variables have missing values then prints a message and exits.
Andrew Robinson <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
test <- data.frame(a = c(1,2), b = c(3,4)) show.cols.with.na(test) is.na(test$a[2]) <- TRUE show.cols.with.na(test)
test <- data.frame(a = c(1,2), b = c(3,4)) show.cols.with.na(test) is.na(test$a[2]) <- TRUE show.cols.with.na(test)
This function generates a dataframe object that contains the original stem measurements and appends columns named by log.grades, where log.grades corresponds to the minimum log diameters defined by log.breaks.
sp.sums.2( x, log.breaks=c(2,5,12,18,32,999), log.grades=c("pulp","s4","s3","s2","s1","peeler") )
sp.sums.2( x, log.breaks=c(2,5,12,18,32,999), log.grades=c("pulp","s4","s3","s2","s1","peeler") )
x |
The dataframe containing the original stem measurements. |
log.breaks |
The vector defining the minimum diameters for the log grades defined by log.grades. |
log.grades |
The vector defining the text labels for the log.breaks. |
The function generates summaries, by species, for common statistics used in growth and yield simulations.
It performs the same function as the sp.sums
function in the Rconifers library.
A dataframe that contains the original stem measurements with the log volumes appended for each species.
Jeff D. Hamann <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
rconifers::sp.sums
# test <- data.frame(a = c(1,2), b = c(3,4)) # show.cols.with.na(test) # is.na(test$a[2]) <- TRUE # show.cols.with.na(test)
# test <- data.frame(a = c(1,2), b = c(3,4)) # show.cols.with.na(test) # is.na(test$a[2]) <- TRUE # show.cols.with.na(test)
This function is used for fitting the allometric function to bivaraite data. The function is of the form y = alpha x ^ beta, where traditionally x and y are different dimensions of a sampling unit, such as diameter and volume of a tree.
SSallometric(x, alpha, beta)
SSallometric(x, alpha, beta)
x |
predictor variable (e.g. volume) |
alpha |
product parameter |
beta |
exponent parameter |
The function returns a numeric vector of response variables. The vector has two additional attributes: the gradient, which reports the first derivative of the function with respect to the parameters, evaluated at the response value; and the hessian, which reports the matrix of second partial derivatives of the function with respect to the parameters evaluated at the response variable.
Demonstrates construction and usage of self-starting functions using selfStart.
Andrew Robinson <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
SSallometric(10, 2, 3) data(sweetgum) nls(vol.m3 ~ SSallometric(dbh.cm, alpha, beta), data = sweetgum)
SSallometric(10, 2, 3) data(sweetgum) nls(vol.m3 ~ SSallometric(dbh.cm, alpha, beta), data = sweetgum)
The data are internal stem measures from 66 trees. The trees were selected as having been dominant throughout their lives with no visible evidence of damage or forks. The trees came from stands throughout the inland range of the species.
data(stage)
data(stage)
A data frame with 542 observations on the following 11 variables.
Tree.ID
A factor uniquely identifying the tree.
Forest
An integer distinguishing the forest.
HabType
An integer distinguishing the habitat type.
Decade
The decade of the trees life represented by the observation.
Dbhib
Diameter (in.) at 1.37 m (4'6”) inside bark.
Height
Height of tree (ft)
Age
Age of tree at felling
Forest.ID
The national forest in which the tree was felled.
Hab.ID
Daubenmmire's (1952) classification of the local growing conditions: Ts/Pac
Ts/Op
Th/Pach
AG/Pach
PA/Pach
dbhib.cm
Diameter (cm.) at 1.37 m (4'6”) inside bark.
height.m
Height of tree (m)
Quoting Stage (1963), "After felling, the total height was measured, and the age at breast height was determined by counting the rings on a crossection. Then, decadal height growth was measured, starting from the termination of the 1956 height growth. The count of whorls was checked by a ring count at every decadal point. ... Diameters at breast height (measuread along an average radius with a scale having 10 graduations per half inch) corresponding to each decadal height point were also recorded."
The national forests are: Kaniksu, Coeur d'Alene, St. Joe, Clearwater, Nez Perce, Clark Fork, Umatilla, Wallowa, and Payette.
Stage, A. 1963. A mathematical approach to polymorphic site index curves for grand fir. Forest Science 9(2) 167-180.
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
data(stage) str(stage)
data(stage) str(stage)
The original data, also supplied in the package, are measures of stem diameter and height at various locations on the bole of 39 sweetgum trees from Texas, USA.
data(sweetgum)
data(sweetgum)
A data frame with 39 tree-level observations on the following 8 variables.
plot
Identifies the plot in which the tree was felled.
tree
A factor that identifies the tree.
dbh.in
The tree diameter (in.) at 1.37 m (4'6”)
stump.ht.ft
The height of the stump after felling (ft).
height.ft
The height of the tree (ft).
height.m
The height of the tree (m).
dbh.cm
The tree diameter (cm.) at 1.37 m (4'6”)
vol.m3
The estimated biological volume of the stem (cubic meters).
The height measure is of the standing tree, so it includes the stump height. The volume was computed by fitting a spline to the height and diameter measures, and integrating the solid that corresponds to the profile of the spline. See Section 2.4.2 of Robinson and Hamann (2010) for more details.
The data were kindly supplied by Professor Timothy Gregoire and were originally collected by David Lenhart.
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
data(sweetgum) str(sweetgum)
data(sweetgum) str(sweetgum)
These are a subset of the tree measurement data from the Upper Flat Creek unit of the University of Idaho Experimental Forest, which was measured in 1991.
data(ufc)
data(ufc)
A data frame with 336 observations on the following 5 variables.
plot label
tree label
species kbd with levels DF, GF, WC, WL
tree diameter at 1.37 m. from the ground, measured in centimetres.
tree height measured in metres
The inventory was based on variable radius plots with 6.43 sq. m. per ha. BAF (Basal Area Factor). The forest stand was 121.5 ha. This version of the data omits errors, trees with missing heights, and uncommon species. The four species are Douglas-fir, grand fir, western red cedar, and western larch.
The data are provided courtesy of Harold Osborne and Ross Appelgren of the University of Idaho Experimental Forest.
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
data(ufc)
data(ufc)
This vectorized function uses models and parameter estimates from Wykoff et al. (1982) to predict tree volumes given tree heights (m) and over-bark diameter measurements (cm) taken at 1.37 m (4'6”). The function vol.fvs.ni.bdft performs the computation in imperial units, and vol.fvs.ni.m3 is a wrapper for convenience.
vol.fvs.ni.m3(spp, dbh.cm, ht.m) vol.fvs.ni.bdft(spp, dbh.in, ht.ft)
vol.fvs.ni.m3(spp, dbh.cm, ht.m) vol.fvs.ni.bdft(spp, dbh.in, ht.ft)
spp |
Tree species. Must be one of: WP, WL, DF, GF, WH, WC, LP, ES, SF, PP, MH |
dbh.cm |
Tree diameter, cm, measured at 1.37 m. from the ground. |
dbh.in |
Tree diameter, in., measured at 1.37 m. from the ground. |
ht.m |
Tree height, m. |
ht.ft |
Tree height, ft. |
The species are: WP = white pine, WL = western larch, DF = Douglas-fir, GF = grand fir, WH = western hemlock, WC = western red cedar, LP = lodgepole pine, ES = Engelmann spruce, SF = subalpine fir, PP = ponderosa pine, and MH = mountain hemlock.
The function returns a vector of tree volumes, in cubic metres.
The function doesn't perform any input checks. Caveat computator.
Andrew Robinson <[email protected]>
Robinson, A.P., and J.D. Hamann. 2010. Forest Analytics with R: an Introduction. Springer.
Wykoff, W. R., Crookston, N. L., Stage, A. R., 1982. User's Guide to the Stand Prognosis Model. GTR-INT 133, USDA Forest Service, Ogden, UT.
vol.fvs.ni.m3(c("DF, WH"), c(25, 27), c(15, 20))
vol.fvs.ni.m3(c("DF, WH"), c(25, 27), c(15, 20))