file.copy("configuration/config_output_MODEL.R",
"configuration/config_output_MYSIMULATION.R")How to configure the output a simulation?
Preliminary information
Simulations are specified through two files:
config_input: to specify the parameters of the simulation (see this page)config_output: to specify output templates to produce to analyse the simulation resutls
config_output.R is used to produce pre-programmed result templates. The templates are located in the results/quarto_templates. Quarto templates are not meant to be rendered directly due to their location in the folder, which makes accessing dependencies rather complicated. Instead, to use templates, we use the function produce_quartos() that calls upon the parameters found in the config_output file.
It is still possible to make a custom .qmd document, by simply placing it at the root of the folder for ease of usage.
By default, this Rproject is parametrized to place rendered file in the results/quarto_render folder.
Create your own config_output file
To configure the simulation, use the config_output_MODEL.R found in the configuration folder.
config_output_MODEL.R is meant to be a template, so it is advised to make a copy for your own usage.
File Structure
config_output is divided in two parts:
- designation of templates to produce
- parameters of templates
Templates to call
The first part lists the templates available. Up-to-date models for config_output containing all available templates are available upon request.
quartos_to_render <-list(
basic_results = TRUE,
standard_shocks = FALSE ,
PIB = TRUE
)Setting an element to TRUE will enable its rendering when using the function produce_quartos(). Conversely FALSE will disable it.
Elements of the list are named exactly after .qmd templates found in results/quarto_templates. Meaning, from the example above, the element basic_results will execute the template called if results/quarto_templates/basic_results.qmd
In the example above, the templates rendered will be basic_results.qmd and PIB.qmd
Templates parameters
The second part of the config_output concerns the parameters of the templates.
quartos_parameters <- list(
##### basic
basic_results = list(
project_name = project_name,
startyear = 2019,
endyear = lastyear,
template_default = "ofce",
country_name = "France",
scenario = unname(scenario) # List of scenarii to be plotted
),
##### Cahier de variantes
standard_shocks = list(
startyear = 2020,
endyear = 2050,
lastyear = lastyear,
project_name = project_name,
country_name = "France",
scenario = scenario,
scenario_names = names(scenario),
group = list(`Shocks lambda` = c('ct1','expg1')
# `Shocks on public expenditure and taxes` = c('inct1','expg1','rrsc1','vat1'),
# `Shocks on external trade` = c('wd1','exr10'),
# `Shocks on fossil fuel price` = c('ff10','ct1'),
# `Increase in productivity` = c('prodk10','prode10','prodl10','tpf10')
),
reference = "baseline",
time_waypoints = c(0,3,5,10,20),
language = "fr"
),
##### PIB
PIB = list(
project_name = project_name,
colour = "indianred" ,
scenario = c("ct1") # List of scenarii to be plotted
)
)For each template available, each parameters from their respective YAML is listed and can be modified as such. Objects from the input configuration can be used by simply stating their name as in the example for basic_results.
quartos_parameters <- list(
##### basic
basic_results = list(
project_name = project_name,
startyear = 2019,
endyear = lastyear,
template_default = "ofce",
country_name = "France",
scenario = unname(scenario) # List of scenarii to be plotted
),
)For example, in the parameters for basic results, the input parameter project_name is used from the config_input.
Please note that when using elements from config_input, it is not necessary to call them from the list (ie config$config_input$project_name) as the produce_quarto() function unravels the elements of the config list within its own environment, and therefore only the element itself should be put in the parameters, i.e. project_name.