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.
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
Value
a list containg the following elements :
tree_summary
: a summary of the metric per subplotpolygon
: an sf object : simple feature collection of the subplot's polygonplot_design
: a ggplot object (or a list of ggplot objects) that can easily be modified
Examples
# 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
#> subplot_ID D_summary D_summary_per_ha
#> 1 subplot_0_0 2997.4 10656.19
#> 2 subplot_0_1 2901.0 10708.82
#> 3 subplot_1_0 3312.8 12103.82
#> 4 subplot_1_1 3415.8 12972.33
subplots_201_sum$polygon
#> Simple feature collection with 4 features and 3 fields
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 312956.9 ymin: 451582.6 xmax: 313100.5 ymax: 451723.2
#> CRS: NA
#> subplot_ID D_summary D_summary_per_ha
#> subplot_0_0 subplot_0_0 2997.4 10656.19
#> subplot_0_1 subplot_0_1 2901.0 10708.82
#> subplot_1_0 subplot_1_0 3312.8 12103.82
#> subplot_1_1 subplot_1_1 3415.8 12972.33
#> sf_subplot_polygon
#> subplot_0_0 POLYGON ((313005.7 451723.2...
#> subplot_0_1 POLYGON ((313053.1 451694.5...
#> subplot_1_0 POLYGON ((312981.3 451676.7...
#> subplot_1_1 POLYGON ((313028.4 451650.5...
# \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
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
#> plot_id subplot_ID D_summary D_summary_per_ha
#> 1 201 201_0_0 2997.4 11988.663
#> 2 201 201_0_1 2901.0 11604.686
#> 3 201 201_1_0 3312.8 13251.152
#> 4 201 201_1_1 3415.8 13665.027
#> 5 204 204_0_0 2834.2 11337.826
#> 6 204 204_0_1 3147.3 12590.340
#> 7 204 204_1_0 3127.0 12509.132
#> 8 204 204_1_1 3631.1 14525.715
#> 9 213 213_0_0 2471.7 9885.096
#> 10 213 213_0_1 2981.0 11922.694
#> 11 213 213_1_0 2403.8 9615.580
#> 12 213 213_1_1 2856.0 11425.169
#> 13 223 223_0_0 2555.3 10222.567
#> 14 223 223_0_1 2409.8 9639.165
#> 15 223 223_1_0 2948.3 11793.898
#> 16 223 223_1_1 2620.0 10479.181
# \donttest{
subplots_201_sum$plot_design
# }