Skip to contents

This function generates .Rmd files for creating plots based on user-defined configurations. It reads the specified configuration table, evaluates the selected plot function, and manages the output of plots and tables.

Usage

runPlot(
  projectConfiguration,
  nameOfplotFunction,
  configTableSheet = NULL,
  rmdName = configTableSheet,
  plotNames = NULL,
  suppressExport = FALSE,
  digitsOfSignificanceCSVDisplay = 3,
  inputs = list()
)

Arguments

projectConfiguration

A ProjectConfiguration object containing the project configuration settings. This should include paths to input files and output directories.

nameOfplotFunction

The name of the plot-function as character. The package provide a set of functions which can be addressed, but is also possible to generate a customized function ( see details). Available are - plotTimeProfiles - plotPKBoxwhisker - plotPKForestAggregatedAbsoluteValues - plotPKForestPointEstimateOfAbsoluteValues - plotPKForestAggregatedRatios - plotPKForestPointEstimateOfRatios for more details check the help of these functions

configTableSheet

A character string representing the name of the sheet in the `Plots` configuration table from which to read plot configurations. It should have at least the columns `Header`,`Levels` and `PlotName`

rmdName

A character string specifying the name of the resulting rmd and the sub-folder where results will be saved. The default value will be the sheet name of the plot configuration.

plotNames

A character vector of plot names to filter which plots should be generated. Default is NULL. If provided, `suppressExport` is set to TRUE, all plots specified in the configuration will be processed and provided as list, but not exported to the Rmd file.

suppressExport

A logical value indicating whether to suppress the export of the Rmd file. If TRUE, the function will return the generated plots as a list without creating the Rmd file

digitsOfSignificanceCSVDisplay

digits Of significance used for the display in the .Rmd for tables, which are exported as .csv

inputs

A list of additional inputs for the plot function. This can include any parameters that the selected plot function requires.

Value

An invisible list of plots generated by the function. Each element in the list corresponds to a plot created during the execution. If `plotNames` is provided, the Rmd export is suppressed, and only the plot list is returned.

Details

The `runPlot` function is designed to facilitate the generation of plots based on configurations defined in a specified configuration table. The function will: - Load the configuration table for plots based on the specified sheet name. - Validate the configuration and ensure that all required parameters are provided. - Execute the designated plot function. - Save the generated plots in the specified subfolder named rmdName, if export is not suppressed.

If the `plotNames` parameter is set, the function will suppress the Rmd export and return a list of plots generated instead. This is useful when you want to generate specific plots without creating an accompanying .Rmd file for fast check in the daily work.

Users can utilize the `openFigureTemplate` function to open a template for creating custom plot functions. This function can be called directly: `openFigureTemplate().` Additionally, the template is available as an RStudio Add-in for easy access.

Examples

if (FALSE) { # \dontrun{
# Run the plot generation function with Rmd export
runPlot(
  projectConfiguration = projectConfiguration,
  nameOfplotFunction = "plotTimeProfiles",
  configTableSheet = "TimeProfiles",
  inputs = list(dataObserved = dataObserved, scenarioResults = scenarioResults)
)

# Run the plot generation function without Rmd export, returning a plot list
plotList <- runPlot(
  projectConfiguration = projectConfiguration,
  nameOfplotFunction = "plotTimeProfiles",
  configTableSheet = "TimeProfiles",
  plotNames = c("Plot1", "Plot2"),
  inputs = list(dataObserved = dataObserved, scenarioResults = scenarioResults)
)

# open the template for custom plot functions
openFigureTemplate()
} # }