Learn R Programming

BIOMASS (version 2.2.3)

subplot_summary: Summarise and display tree information by subplot

Description

After applying the divide_plot() function, this function summarises with any defined function the desired tree metric by sub-plot and displays the plot representation.

Usage

subplot_summary(
  subplots,
  value = NULL,
  draw_plot = TRUE,
  per_ha = TRUE,
  fun = sum,
  ...
)

Value

a list containg the following elements :

  • tree_summary : a summary of the metric per subplot

  • polygon : an sf object : simple feature collection of the subplot's polygon

  • plot_design : a ggplot object (or a list of ggplot objects) that can easily be modified

Arguments

subplots

output of the divide_plot() function

value

a character indicating the column in subplots$tree_data (a tree metric) to be summarised

draw_plot

a logical indicating whether the plot design should be displayed

per_ha

a logical indicating whether the metric summary should be per hectare

fun

the function to be applied

...

optional arguments to fun

Author

Arthur Bailly

Examples

Run this code
# One plot with repeated measurements of each corner
data("NouraguesPlot201")
data("NouraguesTrees")
check_plot201 <- check_plot_coord(
  corner_data = NouraguesPlot201,
  proj_coord = c("Xutm","Yutm"), rel_coord = c("Xfield","Yfield"),
  trust_GPS_corners = TRUE, draw_plot = FALSE)
subplots_201 <- suppressWarnings(
  divide_plot(
    corner_data = check_plot201$corner_coord, 
    rel_coord = c("x_rel","y_rel"), proj_coord = c("x_proj","y_proj"),
    grid_size = 50,
    tree_data =  NouraguesTrees[NouraguesTrees$Plot == 201,],
    tree_coords = c("Xfield","Yfield")))
# Sum summary (by default) of diameter
subplots_201_sum <- subplot_summary(subplots_201 , value = "D", draw_plot = FALSE)
subplots_201_sum$tree_summary
subplots_201_sum$polygon
# \donttest{
  subplots_201_sum$plot_design
# }
# 9th quantile summary (for example) of diameter
subplots_201_quant <- subplot_summary(subplots_201 , value = "D", draw_plot = FALSE,
                                      fun = quantile, probs=0.9)
  

# Dealing with multiple plots
if (FALSE) {
  data("NouraguesCoords")
  nouragues_subplots <- suppressWarnings(
  divide_plot(
     corner_data = NouraguesCoords,
    rel_coord = c("Xfield","Yfield"), proj_coord = c("Xutm","Yutm"),
    corner_plot_ID = "Plot",
    grid_size = 50,
    tree_data = NouraguesTrees, tree_coords =  c("Xfield","Yfield"),
    tree_plot_ID = "Plot"))
  # Sum summary (by default)
  nouragues_sum <- subplot_summary(nouragues_subplots , value = "D", draw_plot = FALSE)
  nouragues_sum$tree_summary
  subplots_201_sum$plot_design
}

Run the code above in your browser using DataLab