Skip to contents

TBD

Usage

fct_combine_mcs_C(.c_sub, .usr)

Arguments

.c_sub

Subset with one land use from the carbon stock input table for the shiny app (c_stocks).

.usr

User inputs' table for the shiny app (user_inputs). Contains the number of iterations of the MCS, carbon fraction if needed and if truncated PDFs should be used when necessary.

Value

A data frame with N simulations of each carbon pool and associated factors and the resulting total carbon stock in tCO2/ha.

Examples

library(dplyr)
library(readxl)
library(mocaredd)

usr <- read_xlsx(
  path = system.file("extdata/example1.xlsx", package = "mocaredd"),
  sheet = "user_inputs",
  na = "NA"
  )
cs <- read_xlsx(
  system.file("extdata/example1.xlsx", package = "mocaredd"),
  sheet = "c_stocks",
  na = "NA"
  )

cs_clean <- cs |> filter(!(is.na(c_value) & is.na(c_pdf_a)))
c_sub <- cs_clean |> filter(lu_id == "ev_wet_closed")

res <- fct_combine_mcs_C(.c_sub = c_sub, .usr = usr)

hist(res$C_all)

round(median(res$C_all))
#> [1] 453