Skip to contents

TBD

Usage

fct_combine_mcs_cpools(.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)

path <- system.file("extdata/example1-4pools.xlsx", package = "mocaredd")

usr <- read_xlsx(path = path, sheet = "user_inputs", na = "NA")
cs <- read_xlsx(path = path, 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")
#> Error in filter(cs_clean, lu_id == "ev_wet_closed"):  In argument: `lu_id == "ev_wet_closed"`.
#> Caused by error:
#> ! object 'lu_id' not found

res <- fct_combine_mcs_cpools(.c_sub = c_sub, .usr = usr)
#> Error: object 'c_sub' not found

hist(res$C_all)
#> Error: object 'res' not found
round(median(res$C_all))
#> Error: object 'res' not found