Package 'forestdynR'

Title: Calculate Forest Dynamics
Description: Determines the dynamics of tree species communities (mortality rates, recruitment, loss and gain in basal area, net changes and turnover). Important notes are a) The 'forest_df' argument (data) must contain the columns 'plot' (plot identification), 'spp' (species identification), DBH_1 (Diameter at breast height in first year of measure) and DBH_2 (Diameter at breast height in second year of measure). DBH_1 and DBH_2 must be numeric values; b) example input file in 'data(forest_df_example)'; c) The argument 'inv_time' represents the time between inventories, in years; d) The 'coord' argument must be of the type 'c(longitude, latitude)', with decimal degree values; e) Argument 'add_wd' represents a dataframe with wood density values (g cm-3) format with three columns ('genus', 'species', 'wd'). This argument is set to NULL by default, and if isn't provided, the wood density will be estimated with the getWoodDensity() function from the 'BIOMASS' package.
Authors: Pedro Higuchi [cre, aut], Ana Carolina Silva [aut], Adam Slabadack [aut]
Maintainer: Pedro Higuchi <[email protected]>
License: GPL (>= 2)
Version: 0.0.1
Built: 2025-01-27 06:11:52 UTC
Source: https://github.com/higuchip/forestdynr

Help Index


ba_b_metrics

Description

Computes basal area (BA) ans Biomass(B) metrics for forest monitoring by category over a specified time interval. This function calculates BA and B metrics for specified groups in a dataset, including gains, losses, recruitment, and mortality.

Usage

ba_b_metrics(forest_df, group_var, inv_time)

Arguments

forest_df

Data frame containing the forest monitoring data.

group_var

String. The name of the column used to group the data, that could be "plot" or "spp".

inv_time

Numeric. The time interval between the two monitoring periods.

Value

A list containing:

sur_gain

Matrix of basal area gain for surviving trees by group.

sur_loss

Matrix of basal area loss for surviving trees by group.

rec_ba

Matrix of basal area for recruited trees by group.

death_ba

Matrix of basal area for dead trees by group.

BA_gain

Matrix of total basal area gain by group.

BA_loss

Matrix of total basal area loss by group.

ba_n0

Total basal area at time 0 by group.

ba_n1

Total basal area at time 1 by group.

loss_rate_ba

Numeric. The basal area loss rate (percent per year) by group.

gain_rate_ba

Numeric. The basal area gain rate (percent per year) by group.

nc_rate_ba

Numeric. The net change rate of basal area (percent per year) by group.

turn_ba

Numeric. The turnover rate of basal area (average of loss and gain rates) by group.

biomass_n0

Total above-ground biomass at time 0 by group.

biomass_n1

Total above-ground biomass at time 1 by group.


check_format()

Description

Verify if the database is correctly formatted

Usage

check_format(forest_df, verbose = TRUE)

Arguments

forest_df

Dataset to be validated

verbose

Logical. If TRUE, messages about errors and warnings will be printed to the console.

Value

A list containing:

status

Logical, TRUE if the format is correct, FALSE if not.

message

A message providing details about any format issues.


create_din_df

Description

Creates a dynamic data frame by combining a list of data and rounding numeric values to a specified number of digits. This function takes a list of data, rounds the numeric values, and combines them into a single data frame with custom column names.

Usage

create_dyn_df(data_list, col_names, round_digits)

Arguments

data_list

A list of data frames or vectors to be combined into a single data frame.

col_names

A character vector of column names to assign to the resulting data frame.

round_digits

Numeric. The number of decimal places to round numeric values in the data to.

Value

A data frame with the combined data and rounded numeric values.


Data set about forest dynamics

Description

Data set about forest dynamics

Usage

data(forest_df_example)

Format

An object of class "data.frame"

plot

The plot identification number in the field.

n

The identification number of the trees.

spp

The scientific name of the species

DBH_1

Numeric. The diameter at breast height (DBH) measurement on the first inventory.

DBH_2

Numeric. The diameter at breast height (DBH) measurement on the second inventory.

References

This dataset was created by Pedro Higuchi, based on his filed research.

Examples

head(forest_df_example)

forest_dyn

Description

Function to calculate forest dynamics, including abundance, mortality and recruitment rates, basal area, and biomass. The function uses diameter at breast height (DBH) data to estimate forest dynamics over time.

Usage

forest_dyn(forest_df, inv_time, coord, add_wd = NULL)

Arguments

forest_df

A dataframe containing the forest plot data, with columns for species name (spp), and two DBH (Diameter at breast height) values (DBH_1 and DBH_2).

inv_time

The number of years between the two forest measurements (time interval between observations).

coord

A vector of geographic coordinates (longitude and latitude) for biomass calculation.

add_wd

Additional wood density data that can be provided for species not included in the database.

Value

A list containing the forest community dynamics, with abundance metrics, dynamic rates, basal area, and biomass by year.

Examples

forest_df <- data(forest_df_example)
coord <- c(-50.17,-27.71)
dyn_object <- forest_dyn(forest_df, inv_time = 5, coord = coord)

save_dyn_files

Description

This function allows the user to save dynamic forest data to CSV files. It prompts the user to select a directory via a graphical interface (using the 'tcltk' package), and then saves several data frames containing forest dynamics information to predefined file names in that directory.

Usage

save_dyn_files(dynamics, verbose = TRUE)

Arguments

dynamics

A list containing four data frames with different forest dynamics data: 1) number of plots ('n_plot'), 2) number of species ('n_species'), 3) basal area by species ('basal_area_species'), 4) basal area by plots ('basal_area_plot').

verbose

Logical. If 'TRUE', the function will print messages indicating the status of the saving process. Default is 'TRUE'.

Value

NULL If the user does not select a folder, the function will return NULL and no files will be saved. Otherwise, the function saves four CSV files and returns a confirmation message.


sdrn_metrics

Description

Calculates survival, death, and recruitment metrics for forest monitoring data over time.

Usage

sdrn_metrics(forest_df, group_var, inv_time)

Arguments

forest_df

Data frame containing the forest monitoring data.

group_var

String. The name of the column used to group the data, that could be "plot" or "spp".

inv_time

Numeric. The time interval between the two monitoring periods.

Value

A list containing the following metrics: - n_sur: Number of surviving trees per group. - n_death: Number of dead trees per group. - n_rec: Number of recruited trees per group. - n_n0: Total number of trees at the start of the interval per group. - n_n1: Total number of trees at the end of the interval per group. - death_rate: Annual death rate per group ( - rec_rate: Annual recruitment rate per group ( - nc_rate: Net change rate of tree count per group ( - turn: Turnover rate, calculated as the mean of death and recruitment rates (