Skip to contents

tsvis_nfi() function analyzes and visualizes data in a time series format. It can visualize 'biomass', 'cwd', and 'iv' data as 'table', 'line', 'bar', or 'map'. Users need to select the specific biomass variable, such as volume or carbon to visualize biomass. For map visualization of biomass, users must choose the administrative unit level. It uses the iv_nfi and biomass_nfi and cwd_biomass_nfi function for core calculations. The function accepts various parameters depending on the analysis type: Common parameters: data, y, output, plotgrp, isannual, ncol, nrow Additional parameters by type: biomass: bm_type(except for 'table'), admin(only 'map'), treegrp, strat, stockedland, talltree, clusterplot, largetreearea cwd: bm_type(except for 'table'), admin(only 'map'), treegrp, strat, stockedland iv: sp, frequency, top When y is set to either 'biomass' or 'cwd': For map output, the function displays two side-by-side spatial visualizations: one showing the results and another showing the relative standard error (RSE). For line or bar outputs, results are displayed with error bars based on the standard error (SE) of the estimates.

Usage

tsvis_nfi(
  data,
  y = "biomass",
  bm_type = NULL,
  output = "line",
  plotgrp = NULL,
  treegrp = NULL,
  isannual = TRUE,
  continuousplot = FALSE,
  admin = NULL,
  strat = "FORTYP_SUB",
  clusterplot = FALSE,
  largetreearea = TRUE,
  stockedland = TRUE,
  talltree = TRUE,
  sp = "SP",
  frequency = TRUE,
  ncol = NULL,
  nrow = NULL,
  top = 20
)

Arguments

data

: A list generated by read_nfi that contains 'plot' and 'tree' data frames.

y

: A character vector; the variable to visualize. Must be one of 'biomass', 'cwd', 'iv'.

bm_type

: A character vector; the specific variable to visualize for 'biomass' or 'cwd'. Must be one of 'volume', 'biomass', 'AG_biomass', 'carbon', 'co2'.

output

: A character vector; the desired type of visualization. Must be one of 'table', 'line', 'bar', 'map'.

plotgrp

: A character vector; specifies variables from the 'plot' table to use for grouping. Use c() to combine multiple variables, but if the output is a map, line or bar plot, only one variable can be used.

treegrp

: A character vector; variables from 'tree' tables for grouping. Use c() to combine multiple variables.

isannual

: A logical flag (default TRUE); if TRUE, the result is provided annually, if FALSE, it is provided in 5-year intervals.

continuousplot

: A logical flag (default TRUE); if TRUE, includes only plots that have been continuously measured in all NFI cycles (5th, 6th, etc.). If FALSE, includes plots regardless of missing cycle measurements.

admin

: A character vector; the administrative unit for visualizing 'biomass' or 'cwd' as a map. Must be one of 'sido', 'sgg', 'emg'.

strat

: A character vector; the variable used for post-stratification. In the National Forest Inventory of Korea, it is typically used by forest type.

clusterplot

: A logical flag (default FALSE); if TRUE, treats each cluster plot as a single unit. If FALSE, calculates for each subplot separately.

largetreearea

: A logical flag (default FALSE); if TRUE, includes large tree survey plots in the analysis. If FALSE, only uses standard tree plots.

stockedland

: A logical flag (default TRUE); if TRUE, includes only stocked land. If FALSE, includes all land types.

talltree

: A logical flag (default TRUE); if TRUE, includes only tall trees. If FALSE, includes both trees and shrubs.

sp

: A character vector; the column name of species information (e.g., "SP" for species, "GENUS" for genus-level analysis).

frequency

: A logical flag (default TRUE); if TRUE, includes frequency in importance value calculations.

ncol

: A numeric vector (default NULL); Number of columns in the grid layout when faceting by plotgrp.

nrow

: A numeric vector (default NULL); Number of columns in the grid layout when faceting by plotgrp.

top

: A numeric vector (default 20); Number of top species to display in 'iv' plot

Value

If the output is a map, line, or bar plot: an object of class ggplot. If the output is a table: a data.frame.

Note

To visualize data as a map, you need to agree to install the kadmin package during the function execution or install it in advance. The kadmin package loads shapefiles for Korea's Si, Do or Si, Gun, Gu or Eup, Myeon, Dong. Use drat::addRepo("SYOUNG9836") install.packages("kadmin") or remotes::install_github("SYOUNG9836/kadmin")

See also

iv_nfi for calculating the importance values. biomass_nfi for calculating the biomass. cwd_biomass_nfi for calculating the biomass of Coarse Woody Debris.

Examples


data("nfi_donghae")

# Visualize importance values as a table
tsvis_iv <- tsvis_nfi(nfi_donghae, y = "iv", output = "table", continuousplot = TRUE)

# Create a bar plot of importance values at 5-year intervals
tsvis_iv_bar <- tsvis_nfi(nfi_donghae, y = "iv", output = "bar", isannual = FALSE, 
                            continuousplot = TRUE)

# Generate a line plot of carbon biomass over time, grouped by age class
tsvis_bm_line <- tsvis_nfi(nfi_donghae, y = "biomass", top = 10, bm_type = "carbon", 
                            output = "line", plotgrp = "AGE_CLS", continuousplot = TRUE)
                            
# \donttest{
# Create a map of volume at the sido level
tsvis_bm_map <- tsvis_nfi(nfi_donghae, admin = "sido", 
                           y = "biomass", bm_type = "volume", output = "map", continuousplot = TRUE)
# }