Skip to contents

This function summarizes the matrix AGB_val given by the function AGBmonteCarlo() by plot. Or just do the sums for each plot of the AGB if the argument AGB_val is the resulting vector from the function computeAGB().

Usage

summaryByPlot(AGB_val, plot, drawPlot = FALSE, subplot = NULL)

Arguments

AGB_val

Matrix resulting from the function AGBmonteCarlo() (AGB_val element of the list), or just the output of the function AGBmonteCarlo(). Or the output of the function computeAGB()

plot

Vector with the code of plot

drawPlot

a logical to draw the plot (see Details)

subplot

Data frame, output of the function cutPlot()

Value

a data frame where:

  • plot: the code of the plot

  • AGB: AGB value at the plot level

  • Cred_2.5: the quantile 2.5\

  • Cred_97.5: the quantile 97.5\

If the subplot is set, the output is a list with the previous data frame and a simple features (sf) geometry object.

Details

If some trees belong to an unknown plot (i.e. NA value in the plot arguments), their AGB values are randomly assigned to a plot at each iteration of the AGB monte Carlo approach. Or discarded when using output from computeAGB().

The drawPlot argument is a logical that if it is set TRUE, a graph will appear with the plot given on absciss and the value of AGB on ordinate, the red segments are the quantile, if AGB_val is the result of the function AGBmonteCarlo(). If the subplot arguments is set and the drawPlot is set TRUE, a graph is drawn with the spatialisation of the plots.

Examples


# Load a database
data(NouraguesHD)
data(KarnatakaForest)

# Modelling height-diameter relationship
HDmodel <- modelHD(D = NouraguesHD$D, H = NouraguesHD$H, method = "log2")

# Retrieving wood density values
# \donttest{
KarnatakaWD <- getWoodDensity(KarnatakaForest$genus, KarnatakaForest$species,
  stand = KarnatakaForest$plotId
)
#> The reference dataset contains 16467 wood density values
#> Your taxonomic table contains 399 taxa
# }

# Propagating errors
# \donttest{
filt <- KarnatakaForest$plotId %in% c("BSP20", "BSP14")
resultMC <- AGBmonteCarlo(
  D = KarnatakaForest$D[filt], WD = KarnatakaWD$meanWD[filt],
  errWD = KarnatakaWD$sdWD[filt], HDmodel = HDmodel
)

plot <- KarnatakaForest$plotId[ filt ]

# The summary by plot
summaryByPlot(AGB_val = resultMC$AGB_simu, plot)
#>    plot      AGB Cred_2.5 Cred_97.5
#> 1 BSP14 155.7296 140.8388  171.9262
#> 2 BSP20 293.2367 270.6981  318.7032

# The summary by plot for computeAGB
H <- retrieveH(KarnatakaForest$D[filt], model = HDmodel)$H
AGB <- computeAGB(KarnatakaForest$D[filt], WD = KarnatakaWD$meanWD[filt], H = H)
summaryByPlot(AGB, plot)
#>    plot      AGB
#> 1 BSP14 156.0048
#> 2 BSP20 294.2444
# }