knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)
library(forestmangr)
library(dplyr)

Travis-CI Build Status CRAN_Status_Badge Coverage Status Project Status: Active – The project has reached a stable, usable state and is being actively developed. PayPal donate button

forestmangr

Processing forest inventory data with methods such as simple random sampling, stratified random sampling and systematic sampling. There are also functions for yield and growth predictions and model fitting, linear and non linear grouped data fitting, and statistical tests.

If you need any help, I’m available for consulting. If you find forestmangr useful, please consider supporting my efforts in developing this open-source R package for the forestry community!

Installation

To install the stable CRAN version, use:

install.packages("forestmangr")

Or you can install forestmangr from github, for the latest dev version with:

# install.packages("devtools")
devtools::install_github("sollano/forestmangr")

Example

library(forestmangr)
library(dplyr)
data("exfm16")
head(exfm16)

Now, we can fit a model for Site estimatation. With nls_table, we can fit a non-linear model, extract it's coefficients, and merge it with the original data in one line. Here we'll use Chapman & Richards model:

age_i <- 64
exfm16_fit <- exfm16 %>%
  nls_table(DH ~ b0 * (1-exp(-b1* age))^b2, mod_start = c( b0=23, b1=0.03, b2 = 1.3), output="merge") %>% 
  mutate(site = DH *( ( (1- exp( -b1/age ))^b2 ) / (( 1 - exp(-b1/age_i))^b2 ))) %>% 
  select(-b0,-b1,-b2)
head(exfm16_fit)

Now, to fit Clutter's model, we can use the fit_clutter function, indicating the DH, B, V, site and Plot variable names:

coefs_clutter <- fit_clutter(exfm16_fit, "age", "DH", "B", "V", "site", "plot")
coefs_clutter

Now, say we wanted to do a Simple Random Sampling Forest Inventory, with 20% as an accepted error. First, let's load the package and some data:

library(forestmangr)
data("exfm2")
data("exfm3")
data("exfm4")
head(exfm3,10)

First we should try a pilot inventory, to see if the number of plots sampled is enough for reaching the desired error:

sprs(exfm3, "VWB", "PLOT_AREA", "TOTAL_AREA", error = 20, pop = "fin")

We can see that we have 10 plots, but 15 more are needed if we want a minimum of 20% error. The exfm4 data has new samples, that we now can use to run a definitive inventory:

sprs(exfm4, "VWB", "PLOT_AREA", "TOTAL_AREA", error = 20, pop = "fin")

The desired error was met.

The exfm2 data has a strata variable. Say we wanted to run a SRS inventory for every stand. We can do this with the .groups argument:

head(exfm2,10)
sprs(exfm2, "VWB", "PLOT_AREA", "STRATA_AREA",.groups="STRATA", error = 20, pop = "fin")

We can also run a stratified random sampling inventory with this data:

strs(exfm2, "VWB", "PLOT_AREA", "STRATA_AREA", "STRATA", error = 20, pop = "fin")

Citation

To cite this package in publications, use:

ABNT:

BRAGA S. R.; OLIVEIRA, M. L. R.; GORGENS, E. B. forestmangr: Forest Mensuration and Management. R package version 0.9.2, 2020. Disponível em: https://CRAN.R-project.org/package=forestmangr

APA:

Sollano Rabelo Braga, Marcio Leles Romarco de Oliveira and Eric Bastos Gorgens (2020). forestmangr: Forest Mensuration and Management. R package version 0.9.2. https://CRAN.R-project.org/package=forestmangr

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments



sollano/forestmangr documentation built on Dec. 3, 2024, 6:51 p.m.