| Title: | Provides a framework for report generation with the ospsuite |
|---|---|
| Description: | The OSP Suite Reporting Framework, which is based on the esqlabsR package, is a robust tool designed to systematically define simulation scenarios, their inputs and outputs, and standardize data import and matching processes. These functionalities allow for easy and automatable model execution and plot generation, ultimately facilitating the generation of customizable reports for OSP physiologically-based pharmacokinetic (PBPK) models. As a result, this framework significantly enhances reporting efficiency, enabling researchers to create clear, tailored reports that effectively communicate complex modeling results. |
| Authors: | Open-Systems-Pharmacology Community [cph], Katrin Coboeken [aut, cre] |
| Maintainer: | Katrin Coboeken <[email protected]> |
| License: | GPL-2 | file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-07-15 13:24:47 UTC |
| Source: | https://github.com/Open-Systems-Pharmacology/OSPSuite.ReportingFramework |
Add biometrics information to config
addBiometricsToConfig(projectConfiguration, dataDT, overwrite = FALSE)addBiometricsToConfig(projectConfiguration, dataDT, overwrite = FALSE)
projectConfiguration |
Object of class 'ProjectConfiguration' containing information on paths and file names |
dataDT |
A 'data.table' with observed data. |
overwrite |
If TRUE, existing rows will be overwritten. |
Other observed data processing:
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateDataGroupId(),
updateOutputPathId(),
validateObservedData()
This function adds a default configuration sheet for distribution vs demographics plots to the plot configuration table. It can either create a new sheet or overwrite an existing one based on the specified parameters.
addDefaultConfigForDistributionsVsDemographics( projectConfiguration, pkParameterDT = NULL, sheetName = "DistributionVsRange", overwrite = FALSE )addDefaultConfigForDistributionsVsDemographics( projectConfiguration, pkParameterDT = NULL, sheetName = "DistributionVsRange", overwrite = FALSE )
projectConfiguration |
A ProjectConfiguration class object containing configuration details, including: - 'plotsFile': A string representing the file path to the Excel workbook containing the plot configurations. |
pkParameterDT |
Optional. A data object containing pkParameter. |
sheetName |
A character string specifying the name of the sheet in the plot configuration table. Default is 'DistributionVsRange'. |
overwrite |
A boolean indicating whether existing configurations should be overwritten. Default is FALSE. |
The function retrieves scenario definitions, output path IDs, and data groups from the project configuration. It checks if the specified sheet already exists and whether to overwrite it. If not, it creates a new header and fills in the default configuration values for the histograms.
Additionally, the function performs a validity check to ensure that it is not executed during a context where helper functions are prohibited (validRun). If such a context is detected, an error is raised to prevent execution.
NULL This function updates the Excel workbook in place and does not return a value.
Other plot configuration helper function:
addDefaultConfigForHistograms(),
addDefaultConfigForPKBoxwhsikerPlots(),
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots()
Other functions to generate histograms:
plotHistograms(),
validateHistogramsConfig()
This function adds a default configuration sheet for histograms to the plot configuration table. It can either create a new sheet or overwrite an existing one based on the specified parameters.
addDefaultConfigForHistograms( projectConfiguration, pkParameterDT = NULL, sheetName = "Histograms", overwrite = FALSE )addDefaultConfigForHistograms( projectConfiguration, pkParameterDT = NULL, sheetName = "Histograms", overwrite = FALSE )
projectConfiguration |
A ProjectConfiguration class object containing configuration details, including: - 'plotsFile': A string representing the file path to the Excel workbook containing the plot configurations. |
pkParameterDT |
Optional. A data object containing pkParameter. |
sheetName |
A character string specifying the name of the sheet in the plot configuration table. Default is "Histograms". |
overwrite |
A boolean indicating whether existing configurations should be overwritten. Default is FALSE. |
The function retrieves scenario definitions, output path IDs, and data groups from the project configuration. It checks if the specified sheet already exists and whether to overwrite it. If not, it creates a new header and fills in the default configuration values for the histograms.
Additionally, the function performs a validity check to ensure that it is not executed during a context where helper functions are prohibited (validRun). If such a context is detected, an error is raised to prevent execution.
NULL This function updates the Excel workbook in place and does not return a value. It is called for its side effects. Add Default Configuration for Histograms
Other plot configuration helper function:
addDefaultConfigForDistributionsVsDemographics(),
addDefaultConfigForPKBoxwhsikerPlots(),
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots()
Other functions to generate plots displaying distribution vs demographics:
plotDistributionVsDemographics(),
validateDistributionVsDemographicsConfig()
This function adds a default configuration sheet for box-and-whisker plots to the plot configuration table. It can either create a new sheet or overwrite an existing one based on the specified parameters.
addDefaultConfigForPKBoxwhsikerPlots( projectConfiguration, pkParameterDT, sheetName = "PKParameter_Boxplot", overwrite = FALSE )addDefaultConfigForPKBoxwhsikerPlots( projectConfiguration, pkParameterDT, sheetName = "PKParameter_Boxplot", overwrite = FALSE )
projectConfiguration |
A ProjectConfiguration class object containing configuration details, including: - 'plotsFile': A string representing the file path to the Excel workbook containing the plot configurations. |
pkParameterDT |
A data.table containing PK parameter data. |
sheetName |
A character string specifying the name of the sheet in the plot configuration table. Default is "PKParameter_Boxplot". |
overwrite |
A boolean indicating whether existing configurations should be overwritten. Default is FALSE. |
The function retrieves scenario definitions, output path IDs, and data groups from the project configuration. It checks if the specified sheet already exists and whether to overwrite it. If not, it creates a new header and fills in the default configuration values for the time profile plots.
Additionally, the function performs a validity check to ensure that it is not executed during a context where helper functions are prohibited ('validRun'). If such a context is detected, an error is raised to prevent execution.
NULL This function updates the Excel workbook in place and does not return a value. It is called for its side effects.
Other plot configuration helper function:
addDefaultConfigForDistributionsVsDemographics(),
addDefaultConfigForHistograms(),
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots()
Other functions to generate box whisker plots:
plotPKBoxwhisker(),
validatePKBoxwhiskerConfig()
Adds default configurations for forest plots to the 'Plots.xlsx' configuration file.
addDefaultConfigForPKForestPlots( projectConfiguration, pkParameterDT, sheetName = "PKParameter_Forest", overwrite = FALSE )addDefaultConfigForPKForestPlots( projectConfiguration, pkParameterDT, sheetName = "PKParameter_Forest", overwrite = FALSE )
projectConfiguration |
A ProjectConfiguration object. |
pkParameterDT |
A data.table containing PK parameter data. |
sheetName |
Name of the sheet to create. |
overwrite |
Logical indicating if existing data should be overwritten. |
NULL (invisible).
plotPKForestAggregatedAbsoluteValues, plotPKForestPointEstimateOfAbsoluteValues,
plotPKForestAggregatedRatios, plotPKForestPointEstimateOfRatios,
Other plot functions:
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other plot configuration helper function:
addDefaultConfigForDistributionsVsDemographics(),
addDefaultConfigForHistograms(),
addDefaultConfigForPKBoxwhsikerPlots(),
addDefaultConfigForTimeProfilePlots()
Other functions to generate forest plots:
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
This function adds a default configuration sheet for time profile plots to the plot configuration table. It can either create a new sheet or overwrite an existing one based on the specified parameters.
addDefaultConfigForTimeProfilePlots( projectConfiguration, dataObserved = NULL, sheetName = "TimeProfiles", overwrite = FALSE )addDefaultConfigForTimeProfilePlots( projectConfiguration, dataObserved = NULL, sheetName = "TimeProfiles", overwrite = FALSE )
projectConfiguration |
A 'ProjectConfiguration' class object containing configuration details, including: - 'plotsFile': A string representing the file path to the Excel workbook containing the plot configurations. |
dataObserved |
Optional. A data object containing observed data, if available. |
sheetName |
A character string specifying the name of the sheet in the plot configuration table. Default is 'TimeProfiles'. |
overwrite |
A boolean indicating whether existing configurations should be overwritten. Default is FALSE. |
The function retrieves scenario definitions, output path IDs, and data groups from the project configuration. It checks if the specified sheet already exists and whether to overwrite it. If not, it creates a new header and fills in the default configuration values for the time profile plots.
Additionally, the function performs a validity check to ensure that it is not executed during a context where helper functions are prohibited ('validRun'). If such a context is detected, an error is raised to prevent execution.
NULL This function updates the Excel workbook in place and does not return a value. It is called for its side effects.
Other plot functions:
addDefaultConfigForPKForestPlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other plot configuration helper function:
addDefaultConfigForDistributionsVsDemographics(),
addDefaultConfigForHistograms(),
addDefaultConfigForPKBoxwhsikerPlots(),
addDefaultConfigForPKForestPlots()
Loop on figure keys, add figure or table
addFiguresAndTables( keyList, subfolder, numbersOf, customStyles = list(), digitsOfSignificance = 3 )addFiguresAndTables( keyList, subfolder, numbersOf, customStyles = list(), digitsOfSignificance = 3 )
keyList |
list of keys |
subfolder |
sub-folder of relative to .Rmd file where figures are saved |
numbersOf |
list with numbers of tables and figures in rmd |
customStyles |
custom-styles to render word document |
digitsOfSignificance |
significance digits for tables |
list of numbers and figures after loop
Other markdown helper function:
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
This function is for the usage outside a 'captureLog' bracket. Inside the bracket 'message("my message Text")' can be used
addMessageToLog(messageText)addMessageToLog(messageText)
messageText |
character with message text |
Other log file management:
captureLog(),
initLogfunction(),
saveSessionInfo(),
setShowLogMessages(),
writeTableToLog(),
writeToLog()
This function performs linear extrapolation for increasing yValues and logarithmic interpolation for decreasing yValues based on the specified grouping identifiers. It modifies the input dtObserved data.table by adding a new column with the predicted values.
addPredictedValues(dtObserved, dtSimulated, identifier)addPredictedValues(dtObserved, dtSimulated, identifier)
dtObserved |
A data.table containing observed data with columns 'xValues', 'yValues', and grouping identifiers. |
dtSimulated |
A data.table containing simulated data with columns 'xValues' and 'yValues'. |
identifier |
A character vector of column names used for grouping in the extrapolation and interpolation process. |
A data.table with an additional column named 'predicted' containing the extrapolated and interpolated values.
This function adds a sensitivity table to the provided project configuration. It loads a template Excel file and populates it with parameter paths from the specified scenario.
addSensitivityTable( projectConfiguration, scenarioList = NULL, scenarioName, sheetName = scenarioName )addSensitivityTable( projectConfiguration, scenarioList = NULL, scenarioName, sheetName = scenarioName )
projectConfiguration |
An object representing the project configuration. |
scenarioList |
A list of scenarios from which to extract parameter paths. Defaults to NULL. |
scenarioName |
The name of the scenario to extract parameter paths from. |
sheetName |
The name of the sheet in the Excel file to populate. Defaults to the value of scenarioName. |
The modified project configuration object.
This function aggregates observed data based on specified groups and an aggregation method. It allows for different aggregation techniques, including geometric and arithmetic standard deviations, percentiles, or a user-defined custom function.
aggregateObservedDataGroups( dataObserved, groups = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], groupSuffix = "aggregated", customFunction = NULL, lloqCheckColumns2of3 = NULL, lloqCheckColumns1of2 = NULL )aggregateObservedDataGroups( dataObserved, groups = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], groupSuffix = "aggregated", customFunction = NULL, lloqCheckColumns2of3 = NULL, lloqCheckColumns1of2 = NULL )
dataObserved |
A 'data.table' containing observed data. |
groups |
A character vector specifying the groups to aggregate. If NULL, all available groups are used. |
aggregationFlag |
A character string indicating the aggregation method. Options include "GeometricStdDev", "ArithmeticStdDev", "Percentiles", or "Custom". |
percentiles |
A numeric vector of percentiles to calculate if 'aggregationFlag' is "Percentiles". Default is c(5, 50, 95). |
groupSuffix |
A character string to append to group names in the aggregated output. Default is 'aggregated'. |
customFunction |
A custom function for aggregation if 'aggregationFlag' is "Custom". Default is NULL. |
lloqCheckColumns2of3 |
A character vector specifying columns to check for LLOQ (Lower Limit of Quantification) for 1/3 data points. Default is NULL, is used only for 'aggregationFlag' "Custom". |
lloqCheckColumns1of2 |
A character vector specifying columns to check for LLOQ for 2/3 data points. Default is NULL, is used only for 'aggregationFlag' "Custom". |
The function also checks for values below the Lower Limit of Quantification (LLOQ) and adjusts the aggregated results accordingly. For aggregationFlag 'GeometricStdDev' and 'GeometricStdDev', the statistics at any time point will only be calculated if at least 2/3 of the individual data were measured and were above the lower limit of quantification (lloq). For aggregationFlag 'Percentile', the statistics will only be calculated if less than or equal to 1/2 of the data is above LLOQ. If you use aggregationFlag 'Custom', please set parameters lloqCheckColumns2of3 and lloqCheckColumns1of2 accordingly.
A custom function should take a numeric vector 'y' as input and return a list containing: - 'yValues': The aggregated value (e.g., mean). - 'yMin': The lower value of the aggregated data (e.g., mean - sd). - 'yMax': The upper value of the aggregated data (e.g., mean + sd). - 'yErrorType': A string indicating the type of error associated with the aggregation, it is used in plot legends and captions. It must be a concatenation of the descriptor of yValues and the descriptor of yMin - yMax range separated by "|" (e.g., "mean | standard deviation" or "median | 5th - 95th percentile").
A 'data.table' containing aggregated observed data.
Other observed data processing:
addBiometricsToConfig(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateDataGroupId(),
updateOutputPathId(),
validateObservedData()
enumeration biometric units
BIOMETRICUNITSBIOMETRICUNITS
An object of class list of length 3.
Other enumerations:
DATACLASS,
EXPORTDIR,
TIMERANGE
This function calculates pharmacokinetic (PK) parameters for specified scenarios based on project configuration and simulation results. It generates output files for each scenario in the designated output folder.
calculatePKParameterForScenarios(projectConfiguration, scenarioResults)calculatePKParameterForScenarios(projectConfiguration, scenarioResults)
projectConfiguration |
A list containing project configuration settings, including the output folder path and the PK parameter file. |
scenarioResults |
A named list of scenario results, each containing simulation data for PK analysis. |
This function is called for its side effects and does not return a value.
Other scenario management:
createScenarios.wrapped(),
loadPKParameter(),
loadScenarioResultsToFramework(),
runAndSaveScenarios(),
runOrLoadScenarios()
function that catches messages, warnings, and errors. This function has to be initialized by 'initLogfunction' function
captureLog(expr, finallyExpression = invisible())captureLog(expr, finallyExpression = invisible())
expr |
The expression to evaluate. |
finallyExpression |
The expression to evaluate finally |
Other log file management:
addMessageToLog(),
initLogfunction(),
saveSessionInfo(),
setShowLogMessages(),
writeTableToLog(),
writeToLog()
Format corresponds to 'data.table' produced by 'readObservedDataByDictionary'.
convertDataCombinedToDataTable(datacombined)convertDataCombinedToDataTable(datacombined)
datacombined |
The input 'DataCombined' object. |
A 'data.table' containing the converted data.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateDataGroupId(),
updateOutputPathId(),
validateObservedData()
The 'data.table' must be formatted like a table produced by 'readObservedDataByDictionary'.
convertDataTableToDataCombined(dataDT)convertDataTableToDataCombined(dataDT)
dataDT |
A 'data.table' to convert. |
An object of class 'DataCombined'.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
readObservedDataByDictionary(),
updateDataGroupId(),
updateOutputPathId(),
validateObservedData()
Opens a template file a new document
createDocumentFromTemplate( template = "template_workflow", templatePath = system.file("templates", package = "ospsuite.reportingframework") )createDocumentFromTemplate( template = "template_workflow", templatePath = system.file("templates", package = "ospsuite.reportingframework") )
template |
name of template script |
templatePath |
path of template script |
Other Addins Support:
createWorkflowTemplate(),
openEPackageTemplate(),
openFigureTemplate(),
openWorkflowTemplate()
Create a 'ProjectConfigurationRF' based on the '"ProjectConfiguration.xlsx"'
based on esqlabsR::ProjectConfiguration but with additional file information for PK Parameter definitions
createProjectConfiguration(path = file.path("ProjectConfiguration.xlsx"))createProjectConfiguration(path = file.path("ProjectConfiguration.xlsx"))
path |
path to the 'ProjectConfiguration.xlsx' file. default to the 'ProjectConfiguration.xlsx' file located in the working directory. |
Object of type 'ProjectConfigurationRF'
Other project initialization:
ProjectConfigurationRF,
getQCpassedEnvironmentVariable(),
initProject(),
setWorkflowOptions()
wrap of 'esqlabsR::createDefaultProjectConfiguration()' with 'esqlabsR::createScenarios()' as input
createScenarios.wrapped(projectConfiguration, scenarioNames = NULL)createScenarios.wrapped(projectConfiguration, scenarioNames = NULL)
projectConfiguration |
Object of class 'ProjectConfiguration' containing information on paths and file names |
scenarioNames |
Names of the scenarios that are defined in the excel file. If NULL (default), all scenarios specified in the excel file will be created. |
Named list of Scenario objects.
Other scenario management:
calculatePKParameterForScenarios(),
loadPKParameter(),
loadScenarioResultsToFramework(),
runAndSaveScenarios(),
runOrLoadScenarios()
Opens the workflow template as new document
createWorkflowTemplate()createWorkflowTemplate()
Other Addins Support:
createDocumentFromTemplate(),
openEPackageTemplate(),
openFigureTemplate(),
openWorkflowTemplate()
enumeration keys for 'DataClass'
DATACLASSDATACLASS
An object of class list of length 5.
Other enumerations:
BIOMETRICUNITS,
EXPORTDIR,
TIMERANGE
enumeration keys for exportDirectories
EXPORTDIREXPORTDIR
An object of class list of length 3.
Other enumerations:
BIOMETRICUNITS,
DATACLASS,
TIMERANGE
This function generates virtual populations based on demographic data and exports them to CSV files.
exportRandomPopulations( projectConfiguration, populationNames = NULL, customParameters = NULL, overwrite = FALSE )exportRandomPopulations( projectConfiguration, populationNames = NULL, customParameters = NULL, overwrite = FALSE )
projectConfiguration |
A list containing project configuration details, including: - populationsFile: Path to the Excel file containing population demographics. - populationsFolder: Directory where the generated CSV files will be saved. |
populationNames |
A character vector of population names to generate. If NULL, all populations in the demographics sheet will be considered. |
customParameters |
A list of custom parameters to set for the populations. Each item in the list should be a list containing: - path: The parameter path to set. - values: A vector of values to assign to the parameter. |
overwrite |
A logical indicating whether to overwrite existing population files. Default is FALSE. |
This function does not return a value. It generates and exports CSV files for the specified populations.
Other population export:
exportVirtualTwinPopulations(),
setupVirtualTwinPopConfig()
## Not run: exportRandomPopulations(projectConfiguration, populationNames = c("Population1", "Population2"), customParameters = list(list(path = "param1", values = c(1, 2))), overwrite = TRUE ) ## End(Not run)## Not run: exportRandomPopulations(projectConfiguration, populationNames = c("Population1", "Population2"), customParameters = list(list(path = "param1", values = c(1, 2))), overwrite = TRUE ) ## End(Not run)
This function facilitates the export of a simulation workflow to an electronic package (ePackage). It initializes a 'WorkflowScriptExporter' object and executes a series of operations to prepare the workflow for export, including generating workflow text, retrieving input files, configuring scenario details, and exporting necessary files.
exportSimulationWorkflowToEPackage( projectConfiguration, wfIdentifier, scenarioNames, fileNameReplacements = c() )exportSimulationWorkflowToEPackage( projectConfiguration, wfIdentifier, scenarioNames, fileNameReplacements = c() )
projectConfiguration |
An object of class 'projectConfiguration' that contains various configuration details, including paths for input files, output directories, and any other relevant settings required for the workflow export. |
wfIdentifier |
A unique identifier (integer) for the workflow. This identifier is used to distinguish this workflow from others and is included in the names of the exported files. |
scenarioNames |
A character vector of scenario names that should be included in the workflow export. These scenarios determine which specific configurations and input files will be processed and exported as part of the ePackage. |
fileNameReplacements |
An optional character vector that specifies replacements for file names. The vector should contain pairs of values, where the first value in each pair represents the original file name, and the second value represents the desired replacement name. This allows for customization of exported file names to meet specific naming conventions or requirements. For Files not listed in this variable the source filename is converted to a valid filename. |
Invisible NULL. The function does not return any value but performs a series of operations that result in the creation of exported files and configurations necessary for the ePackage. If successful, the function will complete without errors; otherwise, it will raise an informative error.
Other electronic package:
exportTLFWorkflowToEPackage(),
importWorkflow()
## Not run: # Example usage of exportSimulationWorkflow function exportSimulationWorkflow( projectConfiguration = projectConfiguration, wfIdentifier = 1, scenarioNames = c("Scenario1", "Scenario2"), fileNameReplacements = c("oldName.pkml", "new_name.pkml") ) ## End(Not run)## Not run: # Example usage of exportSimulationWorkflow function exportSimulationWorkflow( projectConfiguration = projectConfiguration, wfIdentifier = 1, scenarioNames = c("Scenario1", "Scenario2"), fileNameReplacements = c("oldName.pkml", "new_name.pkml") ) ## End(Not run)
This function facilitates the export of a TLF (Table-Linked Format) workflow to an electronic package (ePackage). It initializes a 'WorkflowScriptExporter' object, extracts code chunks from the provided R Markdown file, evaluates the code chunks, and executes a series of operations to prepare the workflow for export. This includes generating workflow text, retrieving input files, configuring scenario details, and exporting necessary files.
exportTLFWorkflowToEPackage( projectConfiguration, wfIdentifier, workflowRmd, fileNameReplacements = c() )exportTLFWorkflowToEPackage( projectConfiguration, wfIdentifier, workflowRmd, fileNameReplacements = c() )
projectConfiguration |
An object of class 'projectConfiguration' that contains various configuration details, including paths for input files, output directories, and any other relevant settings required for the workflow export. |
wfIdentifier |
A unique identifier (integer) for the workflow. This identifier is used to distinguish this workflow from others and is included in the names of the exported files. |
workflowRmd |
Path to the input markdown file for the TLF workflow. This file should contain the necessary code chunks that are to be extracted and evaluated for the export process. |
fileNameReplacements |
An optional character vector that specifies replacements for file names. The vector should contain pairs of values, where the first value in each pair represents the original file name, and the second value represents the desired replacement name. This allows for customization of exported file names to meet specific naming conventions or requirements. For files not listed in this variable, the source filename is converted to a valid filename. |
Invisible NULL. The function does not return any value but performs a series of operations that result in the creation of exported files and configurations necessary for the ePackage. If successful, the function will complete without errors; otherwise, it will raise an informative error.
Other electronic package:
exportSimulationWorkflowToEPackage(),
importWorkflow()
## Not run: # Example usage of exportTLFWorkflowToEPackage function exportTLFWorkflowToEPackage( projectConfiguration = projectConfiguration, wfIdentifier = 1, workflowRmd = "path/to/workflow.Rmd", fileNameReplacements = c("oldName.pkml", "new_name.pkml") ) ## End(Not run)## Not run: # Example usage of exportTLFWorkflowToEPackage function exportTLFWorkflowToEPackage( projectConfiguration = projectConfiguration, wfIdentifier = 1, workflowRmd = "path/to/workflow.Rmd", fileNameReplacements = c("oldName.pkml", "new_name.pkml") ) ## End(Not run)
This function generates virtual twin populations based on the provided model and project configuration.
exportVirtualTwinPopulations( projectConfiguration, modelFile, overwrite = FALSE, populationNames = NULL )exportVirtualTwinPopulations( projectConfiguration, modelFile, overwrite = FALSE, populationNames = NULL )
projectConfiguration |
A list containing project configuration details, including file paths for populations and scenarios. |
modelFile |
A string representing the name of the model file to be loaded. This file is used for unit conversion |
overwrite |
A logical indicating whether to overwrite existing files. Defaults to FALSE |
populationNames |
a character vector defining the population which should be exported. If NULL (default) all will be exported |
Other population export:
exportRandomPopulations(),
setupVirtualTwinPopConfig()
This function takes a numeric vector of percentiles and maps specific values to their corresponding labels. It also formats other numeric values based on whether they are integers or not.
formatPercentiles(percentiles, suffix = "", allAsPercentiles = FALSE)formatPercentiles(percentiles, suffix = "", allAsPercentiles = FALSE)
percentiles |
A numeric vector of percentiles (0, 50, 100, and other values). |
suffix |
A character string to append to formatted percentile values. |
allAsPercentiles |
boolean, if FALSE for percentiles = 0,50,100 min, median and max is returned otherwise 0th 50th 100th |
A vector containing the mapped labels for specific percentiles and formatted strings for others.
This function loads the properties for data groups from the specified workbook.
getDataGroups(wbPlots)getDataGroups(wbPlots)
wbPlots |
The path to the workbook containing the data groups. |
A 'data.table' with data group IDs.
Other get identifier:
getModelParameterDefinitions(),
getOutputPathIds(),
getScenarioDefinitions(),
getTimeRangeTags(),
loadConfigTableEnvironment()
This function loads the model parameter definitions from the specified workbook.
getModelParameterDefinitions(wbPlots)getModelParameterDefinitions(wbPlots)
wbPlots |
The path to the workbook containing the model parameter definitions. |
A 'data.table' with model parameter definitions.
Other get identifier:
getDataGroups(),
getOutputPathIds(),
getScenarioDefinitions(),
getTimeRangeTags(),
loadConfigTableEnvironment()
This function loads the output configurations from the specified workbook.
getOutputPathIds(wbPlots)getOutputPathIds(wbPlots)
wbPlots |
The path to the workbook containing the output configurations. |
A 'data.table' with output configurations.
Other get identifier:
getDataGroups(),
getModelParameterDefinitions(),
getScenarioDefinitions(),
getTimeRangeTags(),
loadConfigTableEnvironment()
This function retrieves the value of the environment variable 'QCpassed'. It attempts to convert the value to a logical type. If the environment variable is not set, is empty, or is non-logical, a warning is issued and the function defaults the value to 'FALSE'.
getQCpassedEnvironmentVariable()getQCpassedEnvironmentVariable()
A logical value indicating whether the QC passed ('TRUE' or 'FALSE').
Other project initialization:
ProjectConfigurationRF,
createProjectConfiguration(),
initProject(),
setWorkflowOptions()
## Not run: # Set the environment variable for testing Sys.setenv(QCpassed = "TRUE") getQCpassedEnvironmentVariable() # Should return TRUE # Unset the environment variable for testing Sys.unsetenv("QCpassed") getQCpassedEnvironmentVariable() # Should return FALSE and issue a warning ## End(Not run)## Not run: # Set the environment variable for testing Sys.setenv(QCpassed = "TRUE") getQCpassedEnvironmentVariable() # Should return TRUE # Unset the environment variable for testing Sys.unsetenv("QCpassed") getQCpassedEnvironmentVariable() # Should return FALSE and issue a warning ## End(Not run)
This function loads the scenario definitions from the specified workbooks.
getScenarioDefinitions(wbScenarios, wbPlots = NULL)getScenarioDefinitions(wbScenarios, wbPlots = NULL)
wbScenarios |
The path to the workbook containing additional scenario definitions. |
wbPlots |
The path to the workbook containing the scenario definitions. |
A 'data.table' with scenario definitions.
Other get identifier:
getDataGroups(),
getModelParameterDefinitions(),
getOutputPathIds(),
getTimeRangeTags(),
loadConfigTableEnvironment()
This function loads the time range tags from the specified workbook.
getTimeRangeTags(wbPlots)getTimeRangeTags(wbPlots)
wbPlots |
The path to the workbook containing the time range tags. |
A 'data.table' with time range tags.
Other get identifier:
getDataGroups(),
getModelParameterDefinitions(),
getOutputPathIds(),
getScenarioDefinitions(),
loadConfigTableEnvironment()
This function imports a workflow from an electronic package (ePackage) into a project directory. It initializes the project configuration, retrieves relevant project files, and synchronizes scenarios with plots. The function ensures that the necessary directories exist and that the configuration is set up correctly for further processing.
importWorkflow( projectDirectory, wfIdentifier, ePackageFolder, configurationDirectory )importWorkflow( projectDirectory, wfIdentifier, ePackageFolder, configurationDirectory )
projectDirectory |
A character string representing the path to the project directory where the workflow will be imported. |
wfIdentifier |
An integer identifier for the workflow being imported. This identifier is used to distinguish between different workflows. |
ePackageFolder |
A character string representing the path to the electronic package folder that contains the workflow files and configurations to be imported. |
configurationDirectory |
A character string representing the directory where the configuration files will be stored. |
An object containing the updated project configuration after the workflow has been imported.
Other electronic package:
exportSimulationWorkflowToEPackage(),
exportTLFWorkflowToEPackage()
This function initialize the logging during a workflow. It is called at the start of the workflow script. It is used to configure options for the log file folder, warnings which should not logged and messages which should not logged.
initLogfunction( projectConfiguration, warningsNotDisplayed = c("introduced infinite values", "Each group consists of only one observation", "rows containing non-finite values", "rows containing missing values", "Ignoring unknown parameters", "was deprecated in ggplot2", "font family not found in Windows font database", "mbcsToSbcs"), messagesNotDisplayed = c("Each group consists of only one observation"), verbose = TRUE )initLogfunction( projectConfiguration, warningsNotDisplayed = c("introduced infinite values", "Each group consists of only one observation", "rows containing non-finite values", "rows containing missing values", "Ignoring unknown parameters", "was deprecated in ggplot2", "font family not found in Windows font database", "mbcsToSbcs"), messagesNotDisplayed = c("Each group consists of only one observation"), verbose = TRUE )
projectConfiguration |
Object of class 'ProjectConfiguration' containing information on paths and file names |
warningsNotDisplayed |
A list of warnings that should not be logged. |
messagesNotDisplayed |
A list of messages that should not be logged. |
verbose |
boolean, if true log message will be shown on the console |
Other log file management:
addMessageToLog(),
captureLog(),
saveSessionInfo(),
setShowLogMessages(),
writeTableToLog(),
writeToLog()
## Not run: # Initialize the log function logFunction <- initLogfunction(rootDirectory = "path/to/project") ## End(Not run)## Not run: # Initialize the log function logFunction <- initLogfunction(rootDirectory = "path/to/project") ## End(Not run)
This function initializes a project directory by creating necessary subdirectories and copying configuration files from a source Excel file. It reads the directory structure and files specified in the provided Excel template and sets up the project environment accordingly.
initProject( configurationDirectory = ".", sourceConfigurationXlsx = system.file("templates", "ProjectConfiguration.xlsx", package = "ospsuite.reportingframework"), templatePath = system.file("templates", package = "ospsuite.reportingframework"), overwrite = FALSE )initProject( configurationDirectory = ".", sourceConfigurationXlsx = system.file("templates", "ProjectConfiguration.xlsx", package = "ospsuite.reportingframework"), templatePath = system.file("templates", package = "ospsuite.reportingframework"), overwrite = FALSE )
configurationDirectory |
A character string specifying the path to the project directory to be initialized. Defaults to the current working directory ('.'). |
sourceConfigurationXlsx |
A character string representing the path to the source Excel file containing the project configuration. By default, it uses the template provided by the 'ospsuite.reportingframework' package. |
templatePath |
path of all template files |
overwrite |
A logical value indicating whether to overwrite existing files in the project directory. Defaults to FALSE, meaning existing files will not be overwritten. |
This function returns an invisible NULL. It is used for its side effects of creating directories and copying files rather than producing a value.
Other project initialization:
ProjectConfigurationRF,
createProjectConfiguration(),
getQCpassedEnvironmentVariable(),
setWorkflowOptions()
This function loads various configuration tables from specified Excel files into a global environment.
loadConfigTableEnvironment(projectConfiguration)loadConfigTableEnvironment(projectConfiguration)
projectConfiguration |
An object of class 'ProjectConfiguration' containing paths to Excel files. |
An invisible value indicating that the loading was successful.
Other get identifier:
getDataGroups(),
getModelParameterDefinitions(),
getOutputPathIds(),
getScenarioDefinitions(),
getTimeRangeTags()
This function loads pharmacokinetic (PK) parameters for specified scenarios based on project configuration and a list of scenarios. It processes each scenario and returns the results as a data.table.
loadPKParameter(projectConfiguration, scenarioListOrResult)loadPKParameter(projectConfiguration, scenarioListOrResult)
projectConfiguration |
A list containing project configuration settings, including the PK parameter file. |
scenarioListOrResult |
A named list of scenarios for which PK parameters are to be loaded. |
A data.table containing the processed PK analyses for all specified scenarios.
A data.table containing the processed PK analyses.
Other scenario management:
calculatePKParameterForScenarios(),
createScenarios.wrapped(),
loadScenarioResultsToFramework(),
runAndSaveScenarios(),
runOrLoadScenarios()
This function loads the results of specified scenarios. If the results do not exist, it returns an error.
loadScenarioResultsToFramework(projectConfiguration, scenarioNames)loadScenarioResultsToFramework(projectConfiguration, scenarioNames)
projectConfiguration |
Configuration for the project, containing paths and settings necessary to load the results. |
scenarioNames |
Character vector of the names of the scenarios whose results are to be loaded. |
A list containing the loaded scenario results, including population data if available. throws Error if the scenario results do not exist.
Other scenario management:
calculatePKParameterForScenarios(),
createScenarios.wrapped(),
loadPKParameter(),
runAndSaveScenarios(),
runOrLoadScenarios()
Insert a bulleted item, making sure that there are sufficient newlines to build a bulleted list
mdBullet(..., bullet = "-", level = 1)mdBullet(..., bullet = "-", level = 1)
... |
passed to 'mdPaste' |
bullet |
'character' type of bullet |
level |
'integer', specifies the indentation level. 'level=1' has no indentation |
Other markdown helper function:
addFiguresAndTables(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
Insert a bulleted item, making sure that there are sufficient newlines to build a bulleted list
mdBullet0(..., bullet = "-", level = 1)mdBullet0(..., bullet = "-", level = 1)
... |
passed to 'mdPaste0' |
bullet |
'character' type of bullet |
level |
'integer', specifies the indentation level. 'level=1' has no indentation |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
add Caption to .Rmd
mdCaption(subfolder, captionFile, captionPrefix, captionStyle = NULL)mdCaption(subfolder, captionFile, captionPrefix, captionStyle = NULL)
subfolder |
The folder where the file is located relative to Rmd |
captionFile |
file containing caption |
captionPrefix |
'a character which starts the caption like 'Figure 1:' |
captionStyle |
'custom-style for captions' |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
Include a figure file with caption
mdFigure( figureNumber, figureFile, captionFile, footNoteFile = NULL, subfolder, addNewPage = TRUE, customStyles = list() )mdFigure( figureNumber, figureFile, captionFile, footNoteFile = NULL, subfolder, addNewPage = TRUE, customStyles = list() )
figureNumber |
number of figure used in caption prefix |
figureFile |
file of Figure |
captionFile |
file containing caption |
footNoteFile |
file containing footnotes |
subfolder |
The folder where the file is located relative to Rmd |
addNewPage |
boolean if TRUE (default) new page is added after |
customStyles |
list of custom styles usable for figure and table captions and footnotes |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
add footnote lines
mdFootNote(subfolder, footNoteFile, footNoteCustomStyle = NULL)mdFootNote(subfolder, footNoteFile, footNoteCustomStyle = NULL)
subfolder |
The folder where the file is located relative to Rmd |
footNoteFile |
file containing footnotes |
footNoteCustomStyle |
a character describing custom style footnotes |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
Insert a heading with a specified level.
mdHeading(..., level = 1, newlines = 2)mdHeading(..., level = 1, newlines = 2)
... |
passed to mdPaste |
level |
The header level, i.e. the number of '#'s. Defaults to 1. |
newlines |
The number of newlines inserted after the heading. Defaults to 2. |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
Insert a link to another file, and a newline.
mdLink(label, filename, folder, prefix = "")mdLink(label, filename, folder, prefix = "")
label |
The text to display as the link. |
filename |
The file to link to. |
folder |
The folder where the file is located. |
prefix |
An optional prefix to place in front of the link. Defaults to "". |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
'cat' a line end and start a new line.
mdNewline(n = 1)mdNewline(n = 1)
n |
Number of new lines. Defaults to 1. |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewpage(),
mdPaste(),
mdPaste0(),
mdTable()
'cat' text using 'paste' and optionally end with newlines.
mdPaste(..., sep = " ", collapse = NULL, newlines = 1)mdPaste(..., sep = " ", collapse = NULL, newlines = 1)
... |
Elements to be 'paste'd. |
sep |
Passed to 'paste'. Defaults to '" "'. |
collapse |
Passed to 'paste'. Defaults to 'NULL'. |
newlines |
Number of newlines to insert afterwards. Defaults to 1. |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste0(),
mdTable()
'cat' text using 'paste0' and optionally end with newlines.
mdPaste0(..., collapse = NULL, newlines = 1)mdPaste0(..., collapse = NULL, newlines = 1)
... |
Elements to be 'paste0'd. |
collapse |
Passed to 'paste0'. Defaults to 'NULL'. |
newlines |
Number of newlines to insert afterwards. Defaults to 1. |
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdTable()
Insert a table into a markdown document. Essentially a wrapper for 'knitr::kable' with 'format = "markdown"' and newlines.
mdTable( tableNumber, tableCsv, captionFile, footNoteFile, subfolder, customStyles, digitsOfSignificance = 3, addNewPage = TRUE, ... )mdTable( tableNumber, tableCsv, captionFile, footNoteFile, subfolder, customStyles, digitsOfSignificance = 3, addNewPage = TRUE, ... )
tableNumber |
number of table for caption prefix |
tableCsv |
path of .csv file |
captionFile |
file containing caption |
footNoteFile |
file containing footnotes |
subfolder |
The folder where the file is located relative to Rmd |
customStyles |
list of custom styles usable for figure and table captions and footnotes |
digitsOfSignificance |
significance digits to display (default 3) |
addNewPage |
boolean if TRUE (default) new page is added after |
... |
passed to 'knitr::kable' |
'x', invisibly
Other markdown helper function:
addFiguresAndTables(),
mdBullet(),
mdBullet0(),
mdCaption(),
mdFigure(),
mdFootNote(),
mdHeading(),
mdLink(),
mdNewline(),
mdNewpage(),
mdPaste(),
mdPaste0()
Creates Rmd file which include specified .Rmd s
mergeRmds( newName = "appendix", title = "Appendix", sourceRmds = c("Demographics", "TimeProfile", "PKParameter", "DDIRatio", "myFigures"), projectConfiguration )mergeRmds( newName = "appendix", title = "Appendix", sourceRmds = c("Demographics", "TimeProfile", "PKParameter", "DDIRatio", "myFigures"), projectConfiguration )
newName |
new Name of .Rmd |
title |
Title of new Rmd |
sourceRmds |
list of .rmds to include |
projectConfiguration |
Object of class 'ProjectConfiguration' containing information on paths and file names |
Opens the template for figure creation as new document
openEPackageTemplate()openEPackageTemplate()
Other Addins Support:
createDocumentFromTemplate(),
createWorkflowTemplate(),
openFigureTemplate(),
openWorkflowTemplate()
Opens the template for figure creation as new document
openFigureTemplate()openFigureTemplate()
Other Addins Support:
createDocumentFromTemplate(),
createWorkflowTemplate(),
openEPackageTemplate(),
openWorkflowTemplate()
Per default the workflow template of the package is loaded. To customize it save the file with name "template_workflow.R" in your template directory and set the path to the template via option ‘options(OSPSuite.RF.PathForWorkflowTemplate = ’myTemplateDirectory')'
openWorkflowTemplate()openWorkflowTemplate()
Other Addins Support:
createDocumentFromTemplate(),
createWorkflowTemplate(),
openEPackageTemplate(),
openFigureTemplate()
This function visualizes the relationship between predicted and observed values, allowing for easy identification of discrepancies.
ospsuite_plotPredictedVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )ospsuite_plotPredictedVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. Units should be consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
... |
Additional arguments passed to 'ospsuite.plots::plotPredVsObs'. |
A 'ggplot2' plot object representing predicted vs observed values.
## Not run: # Generate a predicted vs observed plot for the provided data plotPredictedVsObserved(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a predicted vs observed plot for the provided data plotPredictedVsObserved(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
This function visualizes the distribution of predicted vs observed values using a Q-Q plot.
ospsuite_plotQuantileQuantilePlot( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )ospsuite_plotQuantileQuantilePlot( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. Units should be consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
... |
Additional arguments passed to 'ospsuite.plots::plotQQ'. |
A 'ggplot2' plot object representing the Q-Q plot.
## Not run: # Generate a Q-Q plot for the provided data plotQuantileQuantilePlot(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a Q-Q plot for the provided data plotQuantileQuantilePlot(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
This function generates a histogram of the residuals, providing a visual representation of their distribution.
ospsuite_plotResidualsAsHistogram( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )ospsuite_plotResidualsAsHistogram( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. Units should be consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
... |
Additional arguments passed to 'ospsuite.plots::plotHistogram'. |
A 'ggplot2' plot object representing the histogram of residuals.
## Not run: # Generate a histogram of residuals for the provided data plotResidualsAsHistogram(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a histogram of residuals for the provided data plotResidualsAsHistogram(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
This function visualizes the residuals against observed values, helping to assess model performance.
ospsuite_plotResidualsVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )ospsuite_plotResidualsVsObserved( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. Units should be consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
... |
Additional arguments passed to 'ospsuite.plots::plotResVsCov'. |
A 'ggplot2' plot object representing residuals vs observed values.
## Not run: # Generate a residuals vs observed plot for the provided data plotResidualsVsObserved(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a residuals vs observed plot for the provided data plotResidualsVsObserved(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
This function visualizes the residuals over time, providing insights into the accuracy of the model predictions.
ospsuite_plotResidualsVsTime( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )ospsuite_plotResidualsVsTime( plotData, metaData = NULL, mapping = ggplot2::aes(), ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. Units should be consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
... |
Additional arguments passed to 'ospsuite.plots::plotResVsCov'. |
A 'ggplot2' plot object representing residuals vs time.
## Not run: # Generate a residuals vs time plot for the provided data plotResidualsVsTime(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a residuals vs time plot for the provided data plotResidualsVsTime(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
This function generates a time profile plot using ggplot2, where the data is grouped by a column named "group".
ospsuite_plotTimeProfile( plotData, metaData = NULL, mapping = ggplot2::aes(), observedMapping = mapping, ... )ospsuite_plotTimeProfile( plotData, metaData = NULL, mapping = ggplot2::aes(), observedMapping = mapping, ... )
plotData |
An object of class DataCombined or a data.frame generated by a DataCombined object. It is essential that the units are consistent; if not, use 'convertUnits(myDataCombined)' to standardize. |
metaData |
A list containing metadata for the plot. If NULL, a default list is constructed from the data. |
mapping |
additional mappings specified by user |
observedMapping |
Aesthetic mappings for the observed data, typically created with 'ggplot2::aes()'. |
... |
Additional arguments passed to 'ospsuite.plots::plotTimeProfile'. |
A 'ggplot2' plot object representing the time profile.
## Not run: # Generate a time profile plot for the provided data plotTimeProfile(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)## Not run: # Generate a time profile plot for the provided data plotTimeProfile(convertUnits( myDataCombined, xUnit = ospUnits$Time$h, yUnit = ospUnits$`Concentration [mass]`$`µg/l` )) ## End(Not run)
Generates plots comparing distributions against demographic data based on the provided configuration and data.
plotDistributionVsDemographics( projectConfiguration, onePlotConfig, pkParameterDT = NULL, scenarioList = NULL, asStepPlot = TRUE, aggregationFlag = c("Percentiles", "GeometricStdDev", "ArithmeticStdDev", "Custom"), customFunction = NULL, percentiles = ospsuite.plots::getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], facetAspectRatio = 0.5, colorVector = c(scenario = NA, referenceScenario = NA), ... )plotDistributionVsDemographics( projectConfiguration, onePlotConfig, pkParameterDT = NULL, scenarioList = NULL, asStepPlot = TRUE, aggregationFlag = c("Percentiles", "GeometricStdDev", "ArithmeticStdDev", "Custom"), customFunction = NULL, percentiles = ospsuite.plots::getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], facetAspectRatio = 0.5, colorVector = c(scenario = NA, referenceScenario = NA), ... )
projectConfiguration |
A configuration object for the project, containing necessary settings. |
onePlotConfig |
A configuration table for the specific plot, detailing plot parameters. |
pkParameterDT |
A data.table containing pharmacokinetic (PK) parameter data (optional). |
scenarioList |
A list of scenarios to consider for the plot (optional). |
asStepPlot |
Logical indicating if the plot should be rendered as a step plot (default is TRUE). |
aggregationFlag |
A character vector specifying the aggregation function for simulated data. Options include "GeometricStdDev" (default), "ArithmeticStdDev", "Percentiles", and "Custom". |
customFunction |
Optional. A custom aggregation function that accepts a numeric vector and returns a list with: - 'yValues': The aggregated value (e.g., mean). - 'yMin': The lower bound of the aggregated data (e.g., mean - sd). - 'yMax': The upper bound of the aggregated data (e.g., mean + sd). - 'yErrorType': A string indicating the error type for the aggregation, used for plot legends. |
percentiles |
A numeric vector of percentiles to consider if the aggregation method is set to "Percentiles" (default is c(5, 50, 95)). |
facetAspectRatio |
A numeric value for the aspect ratio of the facets (default is 0.5). |
colorVector |
A named vector for colors corresponding to scenarios (default is c(scenario = NA, referenceScenario = NA)). |
... |
Additional arguments passed to the plotting functions 'ospsuite.plots::plotHistogram' or 'plotRangeDistribution'. |
This function is intended to be used in combination with the 'runPlot' function. Refer to the vignette 'Plot and Report Generation' for more details. It can be configured to plot PK parameters or population parameters, with the X-axis always displaying the population parameter.
A helper function, 'addDefaultConfigForDistributionsVsDemographics', is available to streamline the setup of your Excel configuration sheet for histograms. This function automatically populates a new sheet with default values that can be customized as needed.
A list of plot objects generated based on the input configuration.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate plots displaying distribution vs demographics:
addDefaultConfigForHistograms(),
validateDistributionVsDemographicsConfig()
## Not run: # Example for plotting a histogram of PK-parameters of a scenario compared to a reference scenario: runPlot( nameOfplotFunction = "plotDistributionVsDemographics", projectConfiguration = projectConfiguration, configTableSheet = "DistributionVsRange", inputs = list( scenarioList = scenarioList, pkParameterDT = pkParameterDT, aggregationFlag = "GeometricStdDev" ) ) ## End(Not run)## Not run: # Example for plotting a histogram of PK-parameters of a scenario compared to a reference scenario: runPlot( nameOfplotFunction = "plotDistributionVsDemographics", projectConfiguration = projectConfiguration, configTableSheet = "DistributionVsRange", inputs = list( scenarioList = scenarioList, pkParameterDT = pkParameterDT, aggregationFlag = "GeometricStdDev" ) ) ## End(Not run)
Generates histogram plots based on the provided configuration and data.
plotHistograms( projectConfiguration, onePlotConfig, pkParameterDT = NULL, scenarioList = NULL, facetAspectRatio = 0.5, colorVector = c(scenario = NA, referenceScenario = NA), nMaxFacetRows = 2, ... )plotHistograms( projectConfiguration, onePlotConfig, pkParameterDT = NULL, scenarioList = NULL, facetAspectRatio = 0.5, colorVector = c(scenario = NA, referenceScenario = NA), nMaxFacetRows = 2, ... )
projectConfiguration |
A configuration object for the project, containing necessary settings. |
onePlotConfig |
A configuration table for the specific plot, detailing plot parameters. |
pkParameterDT |
A data.table containing pharmacokinetic (PK) parameter data (optional). |
scenarioList |
A list of scenarios to consider for the plot (optional). |
facetAspectRatio |
A numeric value for the aspect ratio of the facets (default is 0.5). |
colorVector |
A named vector for colors corresponding to scenarios (default is c(scenario = NA, referenceScenario = NA)). |
nMaxFacetRows |
Maximum number of facet rows (default is 2). |
... |
Additional arguments passed to the histogram plotting function. |
This function is intended to be used in combination with the 'runPlot' function. Refer to the vignette 'Plot and Report Generation' for more details. It can be configured to plot PK parameters or model parameters.
A helper function, 'addDefaultConfigForHistograms', is available to streamline the setup of your Excel configuration sheet for histograms. This function automatically populates a new sheet with default values that can be customized as needed.
A list of histogram plot objects generated based on the input configuration.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate histograms:
addDefaultConfigForDistributionsVsDemographics(),
validateHistogramsConfig()
## Not run: # Example for plotting a histogram of PK-parameters of a scenario compared to a reference scenario: runPlot( nameOfplotFunction = "plotHistograms", projectConfiguration = projectConfiguration, configTableSheet = "HistogramTest", inputs = list( scenarioList = scenarioList, pkParameterDT = pkParameterDT, colorVector = c( "PO application" = "red", "IV application" = "green" ) ) ) ## End(Not run)## Not run: # Example for plotting a histogram of PK-parameters of a scenario compared to a reference scenario: runPlot( nameOfplotFunction = "plotHistograms", projectConfiguration = projectConfiguration, configTableSheet = "HistogramTest", inputs = list( scenarioList = scenarioList, pkParameterDT = pkParameterDT, colorVector = c( "PO application" = "red", "IV application" = "green" ) ) ) ## End(Not run)
Generates box-and-whisker plots for pharmacokinetic (PK) parameters based on a provided project configuration and plot configuration. This function creates visual representations of the distribution of PK parameters across different scenarios, allowing for comparison of absolute values and ratios.
plotPKBoxwhisker( projectConfiguration, onePlotConfig, pkParameterDT, percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles), xAxisTextAngle = 0, colorVector = c(scenario = NA, referenceScenario = NA), facetAspectRatio = 0.5, ... )plotPKBoxwhisker( projectConfiguration, onePlotConfig, pkParameterDT, percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles), xAxisTextAngle = 0, colorVector = c(scenario = NA, referenceScenario = NA), facetAspectRatio = 0.5, ... )
projectConfiguration |
A ProjectConfiguration object that contains settings and paths relevant to the project. |
onePlotConfig |
A data.table containing configuration settings for a single plot, including details about which plots to generate and their formatting. |
pkParameterDT |
A data.table containing PK parameter data. |
percentiles |
A numeric vector specifying the percentiles to calculate for the box-and-whisker plots. Default is retrieved from project options. |
xAxisTextAngle |
An integer specifying the angle (in degrees) for rotating the x-axis text labels. Default is 0 (no rotation). |
colorVector |
A named vector specifying colors for the plots. Names should correspond to the characters defined in the configtable column colorLegend. If your color legend is for example 'DDI|control', your color vector could be colorVector = c(DDI = 'red',control = 'blue'), if no color is defined default values are used. |
facetAspectRatio |
A numeric value specifying the aspect ratio for faceting the plots. Default is 0.5, which may need adjustment based on the number of facets and plot dimensions. |
... |
Additional arguments passed to plotting functions for further customization. |
The function is intended to be used in combination with the 'runPlot' function. See the vignette 'Plot and Report Generation' for more details.
There exists a helper function 'addDefaultConfigForPKBoxwhsikerPlots' which is a helpful utility designed to streamline the process of setting up your Excel configuration sheet for box whisker plots. This function automatically populates a new sheet with default values that you can customize according to your needs.
A list of ggplot objects representing the generated plots. Each plot can be rendered using ggplot2 or similar plotting systems. The list may include both absolute and ratio plots depending on the configuration.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate box whisker plots:
addDefaultConfigForPKBoxwhsikerPlots(),
validatePKBoxwhiskerConfig()
# Example usage of plotPKBoxwhisker ## Not run: plotList <- plotPKBoxwhisker( projectConfiguration = myProjectConfig, onePlotConfig = myPlotConfig, pkParameterDT = myPKData, percentiles = c(0.05, 0.25, 0.5, 0.75, 0.95), xAxisTextAngle = 45, colorVector = c(DDI = "red", control = "blue"), facetAspectRatio = 1, ) ## End(Not run)# Example usage of plotPKBoxwhisker ## Not run: plotList <- plotPKBoxwhisker( projectConfiguration = myProjectConfig, onePlotConfig = myPlotConfig, pkParameterDT = myPKData, percentiles = c(0.05, 0.25, 0.5, 0.75, 0.95), xAxisTextAngle = 45, colorVector = c(DDI = "red", control = "blue"), facetAspectRatio = 1, ) ## End(Not run)
This is one of a group of functions which generates PK forest plots for pharmacokinetic (PK) parameters or population parameter, providing visualizations that can include absolute values or ratios, along with options for displaying variance or point estimates. These functions allow for the comparison of simulated and observed PK parameter data across different scenarios, aiding in the interpretation of variability and uncertainty in the estimates.
The aggregation of data can be customized using the 'aggregationFlag' parameter, which allows for options such as "GeometricStdDev", "ArithmeticStdDev", "Percentiles", and "Custom" functions for calculating summary statistics.
Available functions are:
plotPKForestAggregatedAbsoluteValuesGenerates a PK forest plot displaying absolute values along with variance.
plotPKForestPointEstimateOfAbsoluteValuesGenerates a PK forest plot displaying point estimates.
plotPKForestAggregatedRatiosGenerates a PK forest plot displaying ratios of PK parameters along with variance.
plotPKForestPointEstimateOfRatiosGenerates a PK forest plot displaying point estimates of ratios of PK parameters.
plotPKForestAggregatedAbsoluteValues( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )plotPKForestAggregatedAbsoluteValues( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )
projectConfiguration |
A ProjectConfiguration object containing the necessary settings and file paths for the project. |
onePlotConfig |
A data.table containing configuration settings for a single plot, including plot name, x-axis scale, and other aesthetic settings. |
pkParameterDT |
A data.table containing simulated PK parameter data, including columns for scenario names, parameters, values, and output paths. |
dataObservedPK |
Optional data.table containing observed PK parameter data for comparison, which can include columns for observed values and associated metadata. |
aggregationFlag |
A character string indicating the method of aggregation for variance calculation. Options include "GeometricStdDev", "ArithmeticStdDev", and "Percentiles". (for 'plotPKForestAggregatedAbsoluteValues' and 'plotPKForestAggregatedRatios'): |
percentiles |
A numeric vector specifying which percentiles to calculate and display in the plot, only relevant if 'aggregationFlag = "Percentiles"' (for 'plotPKForestAggregatedAbsoluteValues' and 'plotPKForestAggregatedRatios'): |
customFunction |
An optional custom function for aggregation. A custom function should take a numeric vector 'y' as input and return a list containing: - 'yValues': The aggregated value (e.g., mean). - 'yMin': The lower value of the aggregated data (e.g., mean - sd). - 'yMax': The upper value of the aggregated data (e.g., mean + sd). - 'yErrorType': A string indicating the type of error associated with the aggregation, it is used in plot legends and captions. It must be a concatenation of the descriptor of 'yValues' and the descriptor of 'yMin - yMax' range separated by "|" (e.g., "mean | standard deviation" or "median | 5th - 95th percentile"). |
scaleVectors |
A list containing user-defined scale vectors for the plot aesthetics for simulated and observed data. The list can have up to two components: 'simulated' and 'observed', each containing a list of properties ('color', 'fill', 'shape') to modify the default scale vector settings. |
labelWrapWidth |
Numeric value specifying the maximum width for wrapping labels in the plot to enhance readability. |
vlineIntercept |
Optional numeric value indicating where to draw a vertical line on the plot, often used to denote a reference value. |
withTable |
logical, if TRUE (default) values are displayed as table beside the plot |
relWidths |
Optional numeric vector specifying relative widths for the plot and table. |
digitsToRound |
An integer specifying the number of digits to round in the displayed values. |
digitsToShow |
An integer specifying the number of digits to show in the displayed values. |
The function distinguishes between two cases for ratio calculations:
If the scenarios being compared are based on the same populations (same 'PopulationId' in scenario configuration), the plots will show summary statistics of individual ratios.
If the scenarios are based on different populations, the plots
will display the ratio of summary statistics. This ratio is only available for
plotPKForestPointEstimateOfRatios
The uncertainty in estimates is calculated using a bootstrapping approach. A unique seed is set for each combination of scenario, reference scenario (if available), output path ID, and PK parameter identifier to ensure reproducibility. The number of bootstrap samples is defined by the 'nBootstrap' parameter, and the confidence intervals are determined using the 'confLevel' parameter (e.g., 0.9 for 90
For the bootstrapping process, a unique seed is set for each combination of scenario, 'referenceScenario' (if available), 'outputPathId', and 'PKParameter' identifier. This ensures that results are consistent when a specific combination is used in different plots and that they are reproducible.
In addition to the point estimates and their confidence intervals, the precision watermark is an important feature of these plots. The precision watermark indicates whether the precision requirements for the displayed estimates have been met. The precision is calculated based on the relationship between the estimated values ('xValues') and their corresponding minimum ('xMin') and maximum ('xMax') confidence interval bounds. If the calculated precision falls below a predefined threshold (e.g., 0.01), the watermark is activated, displaying a warning label such as "Outside precision requirement" on the plot. The threshold is set by the option 'OSPSuite.RF.RequiredPrecisison' This alert serves to inform users that the estimates may not be reliable due to insufficient sample sizes or high variability in the data, prompting them to consider increasing the sample size for improved precision. If the precision is sufficient, point estimates are displayed without confidence interval bounds.
By including the precision watermark, users are better equipped to assess the reliability of the point estimates and make informed decisions based on the visualized data.
To support the creation of the configuration table a support function
addDefaultConfigForPKForestPlots is available
A list containing the generated plot objects.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
This is one of a group of functions which generates PK forest plots for pharmacokinetic (PK) parameters or population parameter, providing visualizations that can include absolute values or ratios, along with options for displaying variance or point estimates. These functions allow for the comparison of simulated and observed PK parameter data across different scenarios, aiding in the interpretation of variability and uncertainty in the estimates.
The aggregation of data can be customized using the 'aggregationFlag' parameter, which allows for options such as "GeometricStdDev", "ArithmeticStdDev", "Percentiles", and "Custom" functions for calculating summary statistics.
Available functions are:
plotPKForestAggregatedAbsoluteValuesGenerates a PK forest plot displaying absolute values along with variance.
plotPKForestPointEstimateOfAbsoluteValuesGenerates a PK forest plot displaying point estimates.
plotPKForestAggregatedRatiosGenerates a PK forest plot displaying ratios of PK parameters along with variance.
plotPKForestPointEstimateOfRatiosGenerates a PK forest plot displaying point estimates of ratios of PK parameters.
plotPKForestAggregatedRatios( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )plotPKForestAggregatedRatios( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )
projectConfiguration |
A ProjectConfiguration object containing the necessary settings and file paths for the project. |
onePlotConfig |
A data.table containing configuration settings for a single plot, including plot name, x-axis scale, and other aesthetic settings. |
pkParameterDT |
A data.table containing simulated PK parameter data, including columns for scenario names, parameters, values, and output paths. |
dataObservedPK |
Optional data.table containing observed PK parameter data for comparison, which can include columns for observed values and associated metadata. |
aggregationFlag |
A character string indicating the method of aggregation for variance calculation. Options include "GeometricStdDev", "ArithmeticStdDev", and "Percentiles". (for 'plotPKForestAggregatedAbsoluteValues' and 'plotPKForestAggregatedRatios'): |
percentiles |
A numeric vector specifying which percentiles to calculate and display in the plot, only relevant if 'aggregationFlag = "Percentiles"' (for 'plotPKForestAggregatedAbsoluteValues' and 'plotPKForestAggregatedRatios'): |
customFunction |
An optional custom function for aggregation. A custom function should take a numeric vector 'y' as input and return a list containing: - 'yValues': The aggregated value (e.g., mean). - 'yMin': The lower value of the aggregated data (e.g., mean - sd). - 'yMax': The upper value of the aggregated data (e.g., mean + sd). - 'yErrorType': A string indicating the type of error associated with the aggregation, it is used in plot legends and captions. It must be a concatenation of the descriptor of 'yValues' and the descriptor of 'yMin - yMax' range separated by "|" (e.g., "mean | standard deviation" or "median | 5th - 95th percentile"). |
scaleVectors |
A list containing user-defined scale vectors for the plot aesthetics for simulated and observed data. The list can have up to two components: 'simulated' and 'observed', each containing a list of properties ('color', 'fill', 'shape') to modify the default scale vector settings. |
labelWrapWidth |
Numeric value specifying the maximum width for wrapping labels in the plot to enhance readability. |
vlineIntercept |
Optional numeric value indicating where to draw a vertical line on the plot, often used to denote a reference value. |
withTable |
logical, if TRUE (default) values are displayed as table beside the plot |
relWidths |
Optional numeric vector specifying relative widths for the plot and table. |
digitsToRound |
An integer specifying the number of digits to round in the displayed values. |
digitsToShow |
An integer specifying the number of digits to show in the displayed values. |
The function distinguishes between two cases for ratio calculations:
If the scenarios being compared are based on the same populations (same 'PopulationId' in scenario configuration), the plots will show summary statistics of individual ratios.
If the scenarios are based on different populations, the plots
will display the ratio of summary statistics. This ratio is only available for
plotPKForestPointEstimateOfRatios
The uncertainty in estimates is calculated using a bootstrapping approach. A unique seed is set for each combination of scenario, reference scenario (if available), output path ID, and PK parameter identifier to ensure reproducibility. The number of bootstrap samples is defined by the 'nBootstrap' parameter, and the confidence intervals are determined using the 'confLevel' parameter (e.g., 0.9 for 90
For the bootstrapping process, a unique seed is set for each combination of scenario, 'referenceScenario' (if available), 'outputPathId', and 'PKParameter' identifier. This ensures that results are consistent when a specific combination is used in different plots and that they are reproducible.
In addition to the point estimates and their confidence intervals, the precision watermark is an important feature of these plots. The precision watermark indicates whether the precision requirements for the displayed estimates have been met. The precision is calculated based on the relationship between the estimated values ('xValues') and their corresponding minimum ('xMin') and maximum ('xMax') confidence interval bounds. If the calculated precision falls below a predefined threshold (e.g., 0.01), the watermark is activated, displaying a warning label such as "Outside precision requirement" on the plot. The threshold is set by the option 'OSPSuite.RF.RequiredPrecisison' This alert serves to inform users that the estimates may not be reliable due to insufficient sample sizes or high variability in the data, prompting them to consider increasing the sample size for improved precision. If the precision is sufficient, point estimates are displayed without confidence interval bounds.
By including the precision watermark, users are better equipped to assess the reliability of the point estimates and make informed decisions based on the visualized data.
To support the creation of the configuration table a support function
addDefaultConfigForPKForestPlots is available
A list containing the generated plot objects.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
This is one of a group of functions which generates PK forest plots for pharmacokinetic (PK) parameters or population parameter, providing visualizations that can include absolute values or ratios, along with options for displaying variance or point estimates. These functions allow for the comparison of simulated and observed PK parameter data across different scenarios, aiding in the interpretation of variability and uncertainty in the estimates.
The aggregation of data can be customized using the 'aggregationFlag' parameter, which allows for options such as "GeometricStdDev", "ArithmeticStdDev", "Percentiles", and "Custom" functions for calculating summary statistics.
Available functions are:
plotPKForestAggregatedAbsoluteValuesGenerates a PK forest plot displaying absolute values along with variance.
plotPKForestPointEstimateOfAbsoluteValuesGenerates a PK forest plot displaying point estimates.
plotPKForestAggregatedRatiosGenerates a PK forest plot displaying ratios of PK parameters along with variance.
plotPKForestPointEstimateOfRatiosGenerates a PK forest plot displaying point estimates of ratios of PK parameters.
plotPKForestPointEstimateOfAbsoluteValues( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, statFun = c(`geometric mean` = function(y) exp(mean(log(y[y > 0])))), confLevel = 0.9, nBootstrap = 100, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )plotPKForestPointEstimateOfAbsoluteValues( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, statFun = c(`geometric mean` = function(y) exp(mean(log(y[y > 0])))), confLevel = 0.9, nBootstrap = 100, scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = NULL, withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )
projectConfiguration |
A ProjectConfiguration object containing the necessary settings and file paths for the project. |
onePlotConfig |
A data.table containing configuration settings for a single plot, including plot name, x-axis scale, and other aesthetic settings. |
pkParameterDT |
A data.table containing simulated PK parameter data, including columns for scenario names, parameters, values, and output paths. |
dataObservedPK |
Optional data.table containing observed PK parameter data for comparison, which can include columns for observed values and associated metadata. |
statFun |
A named list of functions used for statistical aggregation, typically including the geometric mean function for bootstrapping. This must be a function accepting as input a numeric vector and returning a numeric value. The input is formatted as a named list, the name is used in plot legends and captions c('geometric mean' = function(y) exp(mean(log(y[y>0])))) (for 'plotPKForestPointEstimateOfAbsoluteValues' and 'plotPKForestPointEstimateOfRatios') |
confLevel |
A numeric value between 0 and 1 indicating the desired confidence level for the intervals (e.g., 0.9 for 90 (for 'plotPKForestPointEstimateOfAbsoluteValues' and 'plotPKForestPointEstimateOfRatios') |
nBootstrap |
An integer indicating the number of bootstrap samples to draw for calculating confidence intervals. (for 'plotPKForestPointEstimateOfAbsoluteValues', 'plotPKForestPointEstimateOfRatios') |
scaleVectors |
A list containing user-defined scale vectors for the plot aesthetics for simulated and observed data. The list can have up to two components: 'simulated' and 'observed', each containing a list of properties ('color', 'fill', 'shape') to modify the default scale vector settings. |
labelWrapWidth |
Numeric value specifying the maximum width for wrapping labels in the plot to enhance readability. |
vlineIntercept |
Optional numeric value indicating where to draw a vertical line on the plot, often used to denote a reference value. |
withTable |
logical, if TRUE (default) values are displayed as table beside the plot |
relWidths |
Optional numeric vector specifying relative widths for the plot and table. |
digitsToRound |
An integer specifying the number of digits to round in the displayed values. |
digitsToShow |
An integer specifying the number of digits to show in the displayed values. |
The function distinguishes between two cases for ratio calculations:
If the scenarios being compared are based on the same populations (same 'PopulationId' in scenario configuration), the plots will show summary statistics of individual ratios.
If the scenarios are based on different populations, the plots
will display the ratio of summary statistics. This ratio is only available for
plotPKForestPointEstimateOfRatios
The uncertainty in estimates is calculated using a bootstrapping approach. A unique seed is set for each combination of scenario, reference scenario (if available), output path ID, and PK parameter identifier to ensure reproducibility. The number of bootstrap samples is defined by the 'nBootstrap' parameter, and the confidence intervals are determined using the 'confLevel' parameter (e.g., 0.9 for 90
For the bootstrapping process, a unique seed is set for each combination of scenario, 'referenceScenario' (if available), 'outputPathId', and 'PKParameter' identifier. This ensures that results are consistent when a specific combination is used in different plots and that they are reproducible.
In addition to the point estimates and their confidence intervals, the precision watermark is an important feature of these plots. The precision watermark indicates whether the precision requirements for the displayed estimates have been met. The precision is calculated based on the relationship between the estimated values ('xValues') and their corresponding minimum ('xMin') and maximum ('xMax') confidence interval bounds. If the calculated precision falls below a predefined threshold (e.g., 0.01), the watermark is activated, displaying a warning label such as "Outside precision requirement" on the plot. The threshold is set by the option 'OSPSuite.RF.RequiredPrecisison' This alert serves to inform users that the estimates may not be reliable due to insufficient sample sizes or high variability in the data, prompting them to consider increasing the sample size for improved precision. If the precision is sufficient, point estimates are displayed without confidence interval bounds.
By including the precision watermark, users are better equipped to assess the reliability of the point estimates and make informed decisions based on the visualized data.
To support the creation of the configuration table a support function
addDefaultConfigForPKForestPlots is available
A list containing the generated plot objects.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
This is one of a group of functions which generates PK forest plots for pharmacokinetic (PK) parameters or population parameter, providing visualizations that can include absolute values or ratios, along with options for displaying variance or point estimates. These functions allow for the comparison of simulated and observed PK parameter data across different scenarios, aiding in the interpretation of variability and uncertainty in the estimates.
The aggregation of data can be customized using the 'aggregationFlag' parameter, which allows for options such as "GeometricStdDev", "ArithmeticStdDev", "Percentiles", and "Custom" functions for calculating summary statistics.
Available functions are:
plotPKForestAggregatedAbsoluteValuesGenerates a PK forest plot displaying absolute values along with variance.
plotPKForestPointEstimateOfAbsoluteValuesGenerates a PK forest plot displaying point estimates.
plotPKForestAggregatedRatiosGenerates a PK forest plot displaying ratios of PK parameters along with variance.
plotPKForestPointEstimateOfRatiosGenerates a PK forest plot displaying point estimates of ratios of PK parameters.
plotPKForestPointEstimateOfRatios( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, nBootstrap = 1000, confLevel = 0.9, statFun = c(`geometric mean` = function(y) exp(mean(log(y[y > 0])))), scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = c(1), withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )plotPKForestPointEstimateOfRatios( projectConfiguration, onePlotConfig, pkParameterDT, dataObservedPK = NULL, nBootstrap = 1000, confLevel = 0.9, statFun = c(`geometric mean` = function(y) exp(mean(log(y[y > 0])))), scaleVectors = list(), labelWrapWidth = 10, vlineIntercept = c(1), withTable = TRUE, relWidths = NULL, digitsToRound = 2, digitsToShow = 2 )
projectConfiguration |
A ProjectConfiguration object containing the necessary settings and file paths for the project. |
onePlotConfig |
A data.table containing configuration settings for a single plot, including plot name, x-axis scale, and other aesthetic settings. |
pkParameterDT |
A data.table containing simulated PK parameter data, including columns for scenario names, parameters, values, and output paths. |
dataObservedPK |
Optional data.table containing observed PK parameter data for comparison, which can include columns for observed values and associated metadata. |
nBootstrap |
An integer indicating the number of bootstrap samples to draw for calculating confidence intervals. (for 'plotPKForestPointEstimateOfAbsoluteValues', 'plotPKForestPointEstimateOfRatios') |
confLevel |
A numeric value between 0 and 1 indicating the desired confidence level for the intervals (e.g., 0.9 for 90 (for 'plotPKForestPointEstimateOfAbsoluteValues' and 'plotPKForestPointEstimateOfRatios') |
statFun |
A named list of functions used for statistical aggregation, typically including the geometric mean function for bootstrapping. This must be a function accepting as input a numeric vector and returning a numeric value. The input is formatted as a named list, the name is used in plot legends and captions c('geometric mean' = function(y) exp(mean(log(y[y>0])))) (for 'plotPKForestPointEstimateOfAbsoluteValues' and 'plotPKForestPointEstimateOfRatios') |
scaleVectors |
A list containing user-defined scale vectors for the plot aesthetics for simulated and observed data. The list can have up to two components: 'simulated' and 'observed', each containing a list of properties ('color', 'fill', 'shape') to modify the default scale vector settings. |
labelWrapWidth |
Numeric value specifying the maximum width for wrapping labels in the plot to enhance readability. |
vlineIntercept |
Optional numeric value indicating where to draw a vertical line on the plot, often used to denote a reference value. |
withTable |
logical, if TRUE (default) values are displayed as table beside the plot |
relWidths |
Optional numeric vector specifying relative widths for the plot and table. |
digitsToRound |
An integer specifying the number of digits to round in the displayed values. |
digitsToShow |
An integer specifying the number of digits to show in the displayed values. |
The function distinguishes between two cases for ratio calculations:
If the scenarios being compared are based on the same populations (same 'PopulationId' in scenario configuration), the plots will show summary statistics of individual ratios.
If the scenarios are based on different populations, the plots
will display the ratio of summary statistics. This ratio is only available for
plotPKForestPointEstimateOfRatios
The uncertainty in estimates is calculated using a bootstrapping approach. A unique seed is set for each combination of scenario, reference scenario (if available), output path ID, and PK parameter identifier to ensure reproducibility. The number of bootstrap samples is defined by the 'nBootstrap' parameter, and the confidence intervals are determined using the 'confLevel' parameter (e.g., 0.9 for 90
For the bootstrapping process, a unique seed is set for each combination of scenario, 'referenceScenario' (if available), 'outputPathId', and 'PKParameter' identifier. This ensures that results are consistent when a specific combination is used in different plots and that they are reproducible.
In addition to the point estimates and their confidence intervals, the precision watermark is an important feature of these plots. The precision watermark indicates whether the precision requirements for the displayed estimates have been met. The precision is calculated based on the relationship between the estimated values ('xValues') and their corresponding minimum ('xMin') and maximum ('xMax') confidence interval bounds. If the calculated precision falls below a predefined threshold (e.g., 0.01), the watermark is activated, displaying a warning label such as "Outside precision requirement" on the plot. The threshold is set by the option 'OSPSuite.RF.RequiredPrecisison' This alert serves to inform users that the estimates may not be reliable due to insufficient sample sizes or high variability in the data, prompting them to consider increasing the sample size for improved precision. If the precision is sufficient, point estimates are displayed without confidence interval bounds.
By including the precision watermark, users are better equipped to assess the reliability of the point estimates and make informed decisions based on the visualized data.
To support the creation of the configuration table a support function
addDefaultConfigForPKForestPlots is available
A list containing the generated plot objects.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotSensitivity(),
plotTimeProfiles()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
Generates sensitivity plots based on the provided project configuration and scenario list.
plotSensitivity(projectConfiguration, onePlotConfig, scenarioList)plotSensitivity(projectConfiguration, onePlotConfig, scenarioList)
projectConfiguration |
A list containing project configuration settings, including file paths and parameters. |
onePlotConfig |
A data frame containing the configuration for a single plot. |
scenarioList |
A list of scenarios for which the sensitivity analysis will be performed. |
A list of plots and tables, where each entry corresponds to a generated sensitivity plot or its data.
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotTimeProfiles()
The 'plotTimeProfiles' function creates a series of time profile plots as facet panels from the provided simulated and observed data. This function is designed to visualize complex time-dependent data by allowing for multiple plots organized in a user-defined layout.
plotTimeProfiles( projectConfiguration, onePlotConfig, dataObserved = NULL, scenarioResults, nMaxFacetRows = 4, facetAspectRatio = 0.5, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, checkForUnusedData = FALSE, referenceScaleVector = list(), ... )plotTimeProfiles( projectConfiguration, onePlotConfig, dataObserved = NULL, scenarioResults, nMaxFacetRows = 4, facetAspectRatio = 0.5, aggregationFlag = c("GeometricStdDev", "ArithmeticStdDev", "Percentiles", "Custom"), percentiles = getOspsuite.plots.option(optionKey = OptionKeys$Percentiles)[c(1, 3, 5)], customFunction = NULL, checkForUnusedData = FALSE, referenceScaleVector = list(), ... )
projectConfiguration |
An object of class 'ProjectConfiguration' containing project settings, including file paths and scenario definitions. This is essential for the function to access the necessary data. |
onePlotConfig |
A configuration table for the specific plot, detailing plot parameters. |
dataObserved |
A 'data.table' (formatted as produced by 'readObservedDataByDictionary') or 'DataCombined' object containing the observed data to be plotted. |
scenarioResults |
A list containing simulated scenario results. |
nMaxFacetRows |
An integer specifying the maximum number of facet rows (default is 4). |
facetAspectRatio |
A numeric value specifying the aspect ratio for the facets (default is 0.5). |
aggregationFlag |
A character vector indicating the type of aggregation function to use for simulated data. Options include "GeometricStdDev" (default), "ArithmeticStdDev", "Percentiles", and "Custom". |
percentiles |
A numeric vector of percentiles to consider if the aggregation method is set to "Percentiles" (default is c(5, 50, 95)). |
customFunction |
An optional custom function for aggregation. A custom function should take a numeric vector 'y' as input and return a list containing: - 'yValues': The aggregated value (e.g., mean). - 'yMin': The lower value of the aggregated data (e.g., mean - sd). - 'yMax': The upper value of the aggregated data (e.g., mean + sd). - 'yErrorType': A string indicating the type of error associated with the aggregation, it is used in plot legends and captions. It must be a concatenation of the descriptor of 'yValues' and the descriptor of 'yMin - yMax' range separated by "|" (e.g., "mean | standard deviation" or "median | 5th - 95th percentile"). |
checkForUnusedData |
A boolean indicating whether to perform quality control on data usage. If TRUE, 'plotList' contains an additional entry 'unusedData'. |
referenceScaleVector |
A named list that configures colors for the display of reference scenarios. The names must be consistent with the labels defined in the config table column ‘colorLegend'. The first entry corresponds to aesthetic ’color', and the second entry to aesthetic 'fill'. Example: referenceScaleVector = list( Simulation = c('blue', 'lightblue'), Reference = c('darkred', 'red') ) # Default is list() |
... |
Additional arguments passed to 'ospsuite.plots::plotTimeprofile'. |
The function primarily focuses on simulated scenarios, with each panel displaying the result of one scenario, or one scenario versus a reference scenario. Plots containing more than one scenario or only observed data are not supported.
The function is intended to be used in combination with the 'runPlot' function. See the vignette 'Plot and Report Generation' for more details.
There exists a helper function 'addDefaultConfigForTimeProfilePlots' which is a helpful utility designed to streamline the process of setting up your Excel configuration sheet for time profile plots. This function automatically populates a new sheet with default values that you can customize according to your needs.
There is a tutorial for this function with many examples in the accompanying vignette: 'Time Profile Plotting Tutorial'.
A list of generated time profile plots
Other plot functions:
addDefaultConfigForPKForestPlots(),
addDefaultConfigForTimeProfilePlots(),
plotDistributionVsDemographics(),
plotHistograms(),
plotPKBoxwhisker(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
plotSensitivity()
## Not run: # Example of using the referenceScaleVector parameter for a DDI Analysis referenceScaleVector <- list( DDI = c("#843C39FF", "#AD494AFF"), Control = c("#3182BDFF", "#6BAED6FF") ) # The scenario would be labeled as 'DDI', with aesthetic color as dark red ("#843C39FF") and # aesthetic fill as light red ("#AD494AFF"). # The reference scenario would be labeled 'Control', # with aesthetic color as dark blue ("#3182BDFF") and # aesthetic fill as light blue ("#6BAED6FF"). # Example of using the referenceScaleVector parameter for a comparison between a pediatric # and an adult simulation using the default colors referenceScaleVector <- list( "Pediatric population" = c(NA, NA), "Adult population" = c(NA, NA) ) # The scenario would be labeled as 'Pediatric population', using the default colors with aesthetic # color dark blue ("#3182BDFF") and aesthetic fill as light blue ("#6BAED6FF"). # The reference scenario would be labeled 'Adult population', with both aesthetic color and fill # as 'grey'. # Example of using the aggregationFlag parameter "Custom" plotList <- runPlot( nameOfplotFunction = "plotTimeProfiles", configTableSheet = "myTimeProfile", projectConfiguration = projectConfiguration, suppressExport = TRUE, inputs = list( scenarioResults = scenarioResults, dataObserved = dataObserved, aggregationFlag = c("Custom"), customFunction = function(y) { list( yValues = mean(y), yMin = mean(y) - sd(y), yMax = mean(y) + sd(y), yErrorType = "mean | standard deviation" ) } ) ) # Example of using the aggregationFlag parameter "Percentiles" plotList <- runPlot( nameOfplotFunction = "plotTimeProfiles", configTableSheet = "myTimeProfile", projectConfiguration = projectConfiguration, suppressExport = TRUE, inputs = list( scenarioResults = scenarioResults, dataObserved = observedData, aggregationFlag = c("Percentiles"), percentiles = c(0.025, 0.5, 0.975) ) ) ## End(Not run)## Not run: # Example of using the referenceScaleVector parameter for a DDI Analysis referenceScaleVector <- list( DDI = c("#843C39FF", "#AD494AFF"), Control = c("#3182BDFF", "#6BAED6FF") ) # The scenario would be labeled as 'DDI', with aesthetic color as dark red ("#843C39FF") and # aesthetic fill as light red ("#AD494AFF"). # The reference scenario would be labeled 'Control', # with aesthetic color as dark blue ("#3182BDFF") and # aesthetic fill as light blue ("#6BAED6FF"). # Example of using the referenceScaleVector parameter for a comparison between a pediatric # and an adult simulation using the default colors referenceScaleVector <- list( "Pediatric population" = c(NA, NA), "Adult population" = c(NA, NA) ) # The scenario would be labeled as 'Pediatric population', using the default colors with aesthetic # color dark blue ("#3182BDFF") and aesthetic fill as light blue ("#6BAED6FF"). # The reference scenario would be labeled 'Adult population', with both aesthetic color and fill # as 'grey'. # Example of using the aggregationFlag parameter "Custom" plotList <- runPlot( nameOfplotFunction = "plotTimeProfiles", configTableSheet = "myTimeProfile", projectConfiguration = projectConfiguration, suppressExport = TRUE, inputs = list( scenarioResults = scenarioResults, dataObserved = dataObserved, aggregationFlag = c("Custom"), customFunction = function(y) { list( yValues = mean(y), yMin = mean(y) - sd(y), yMax = mean(y) + sd(y), yErrorType = "mean | standard deviation" ) } ) ) # Example of using the aggregationFlag parameter "Percentiles" plotList <- runPlot( nameOfplotFunction = "plotTimeProfiles", configTableSheet = "myTimeProfile", projectConfiguration = projectConfiguration, suppressExport = TRUE, inputs = list( scenarioResults = scenarioResults, dataObserved = observedData, aggregationFlag = c("Percentiles"), percentiles = c(0.025, 0.5, 0.975) ) ) ## End(Not run)
An object storing configuration used project-wide
esqlabsR::ProjectConfiguration -> ProjectConfigurationRF
addOnslist with non default configurations
new()
Initializes the ProjectConfiguration object with a specified configuration file path.
Adds new line to configuration xlsx
Read configuration from file Initialize
ProjectConfigurationRF$new(projectConfigurationFilePath = character())
projectConfigurationFilePathA string representing the path to the project configuration file. Print
print()
print prints a summary of the Project Configuration.
ProjectConfigurationRF$print(className = TRUE)
classNameWhether to print the name of the class at the beginning. default to TRUE.
addAddOnFileToConfiguration()
Adds an add-on file to the project configuration.
ProjectConfigurationRF$addAddOnFileToConfiguration( property, value, description, templatePath )
propertyA string representing the name of the property to add.
valueA string representing the basename of the file to add.
descriptionA string providing a description of the property.
templatePathA string representing the path of the file to add.
addAddOnFolderToConfiguration()
Adds an add-on file to the project configuration.
ProjectConfigurationRF$addAddOnFolderToConfiguration( property, value, description )
propertyA string representing the name of the property to add.
valueA string representing the path of the value to add.
descriptionA string providing a description of the property.
templatePathA string representing the path of the template file.
clone()
The objects of this class are cloneable with this method.
ProjectConfigurationRF$clone(deep = FALSE)
deepWhether to make a deep clone.
Other project initialization:
createProjectConfiguration(),
getQCpassedEnvironmentVariable(),
initProject(),
setWorkflowOptions()
This function reads and processes data based on the provided project configuration.
readObservedDataByDictionary( projectConfiguration, spreadData = TRUE, dataClassType = c("timeprofile", "pkParameter"), fileIds = NULL )readObservedDataByDictionary( projectConfiguration, spreadData = TRUE, dataClassType = c("timeprofile", "pkParameter"), fileIds = NULL )
projectConfiguration |
An object containing project configuration details, including the path to the data importer configuration file. |
spreadData |
If TRUE, information derived from observed data, such as identifiers and biometrics, is spread to other tables. |
dataClassType |
A character string indicating the type of data class to process. Options are "timeprofile" or "pkParameter". |
fileIds |
A character vector with file identifiers to be selected, if NULL (default) all are selected. |
A 'data.table' containing the processed data based on the dictionary. The structure includes relevant columns defined in the data dictionary.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
updateDataGroupId(),
updateOutputPathId(),
validateObservedData()
converts .Rmd file to word
renderWord( fileName, wordConversionTemplate = NULL, customStyles = list(FigureCaption = NULL, FigureFootnote = NULL, TableCaption = NULL, TableFootnote = NULL), ... )renderWord( fileName, wordConversionTemplate = NULL, customStyles = list(FigureCaption = NULL, FigureFootnote = NULL, TableCaption = NULL, TableFootnote = NULL), ... )
fileName |
name of .Rmd file to convert to word format (".docx") |
wordConversionTemplate |
template used for conversion |
customStyles |
list of custom styles usable for figure and table captions and footnotes available list elements for styles are: 'FigureCaption', 'FigureFootnote', 'TableCaption' and 'TableFootnote' The selected styles should be defined in the 'wordConversionTemplate' |
... |
passed to render |
## Not run: # Example with customstyles for Footnotes renderWord( fileName = "myReport.Rmd", wordConversionTemplate = "path/to/template/myTemplate.docx", customStyles = list(FigureFootnote = "myFootnoteFormat", TableFootnote = "myFootnoteFormat") ) ## End(Not run)## Not run: # Example with customstyles for Footnotes renderWord( fileName = "myReport.Rmd", wordConversionTemplate = "path/to/template/myTemplate.docx", customStyles = list(FigureFootnote = "myFootnoteFormat", TableFootnote = "myFootnoteFormat") ) ## End(Not run)
This function simulates a list of scenarios and saves the results. If results already exist for a scenario, it will overwrite them based on the provided options.
runAndSaveScenarios( projectConfiguration, scenarioList, simulationRunOptions = NULL, ... )runAndSaveScenarios( projectConfiguration, scenarioList, simulationRunOptions = NULL, ... )
projectConfiguration |
Configuration for the project, containing paths and settings necessary to run the simulations and save the results. |
scenarioList |
Named list of Scenario objects to be simulated. |
simulationRunOptions |
Object of type 'SimulationRunOptions' that will be passed to simulation runs. If 'NULL', default options are used. |
... |
Additional arguments passed to 'esqlabsR::saveScenarioResults'. |
A list containing the simulation results for each scenario that was run.
Other scenario management:
calculatePKParameterForScenarios(),
createScenarios.wrapped(),
loadPKParameter(),
loadScenarioResultsToFramework(),
runOrLoadScenarios()
## Not run: runAndSaveScenarios( projectConfiguration = myProjectConfig, scenarioList = myScenarioList, simulationRunOptions = myRunOptions ) ## End(Not run)## Not run: runAndSaveScenarios( projectConfiguration = myProjectConfig, scenarioList = myScenarioList, simulationRunOptions = myRunOptions ) ## End(Not run)
This function checks if the simulation results for scenarios already exist. If they do, it loads them; otherwise, it runs the scenarios and saves the results.
runOrLoadScenarios( projectConfiguration, scenarioList, simulationRunOptions = NULL, ... )runOrLoadScenarios( projectConfiguration, scenarioList, simulationRunOptions = NULL, ... )
projectConfiguration |
Configuration for the project, containing paths and settings necessary to run the simulations and load the results. |
scenarioList |
Named list of Scenario objects to be managed. |
simulationRunOptions |
Object of type 'SimulationRunOptions' that will be passed to simulation runs. If 'NULL', default options are used. |
... |
Additional arguments passed to 'runAndSaveScenarios'. |
A list containing the simulation results for each scenario that was loaded or run.
Other scenario management:
calculatePKParameterForScenarios(),
createScenarios.wrapped(),
loadPKParameter(),
loadScenarioResultsToFramework(),
runAndSaveScenarios()
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.
runPlot( projectConfiguration, nameOfplotFunction, configTableSheet = NULL, rmdName = configTableSheet, plotNames = NULL, suppressExport = FALSE, digitsOfSignificanceCSVDisplay = 3, inputs = list() )runPlot( projectConfiguration, nameOfplotFunction, configTableSheet = NULL, rmdName = configTableSheet, plotNames = NULL, suppressExport = FALSE, digitsOfSignificanceCSVDisplay = 3, inputs = list() )
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. |
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.
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.
## Not run: # 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() ## End(Not run)## Not run: # 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() ## End(Not run)
This function executes sensitivity analysis for the specified scenarios in the project configuration. It checks for the presence of the sensitivity file and runs the analysis, saving the results to CSV files.
runSensitivityAnalysisForScenarios( projectConfiguration, scenarioList, scenarioNames = NULL, sensitivitysheet, sensitivityAnalysisRunOptions = ospsuite::SensitivityAnalysisRunOptions$new(showProgress = TRUE), overwrite = TRUE )runSensitivityAnalysisForScenarios( projectConfiguration, scenarioList, scenarioNames = NULL, sensitivitysheet, sensitivityAnalysisRunOptions = ospsuite::SensitivityAnalysisRunOptions$new(showProgress = TRUE), overwrite = TRUE )
projectConfiguration |
An object representing the project configuration. |
scenarioList |
A list of scenarios to analyze. |
scenarioNames |
A vector of scenario names to run the analysis on. Defaults to NULL. |
sensitivitysheet |
The name of the sheet in the sensitivity Excel file to use for analysis. |
sensitivityAnalysisRunOptions |
Options for running the sensitivity analysis. Defaults to an instance of 'SensitivityAnalysisRunOptions' with 'showProgress' set to TRUE. |
overwrite |
A logical indicating whether to overwrite existing results. Defaults to TRUE. |
This function can be called at the end of your script to save the session information, including the loaded packages and R version, into a log file. The path for the log file has to be initialized by the 'initLogfunction'
saveSessionInfo()saveSessionInfo()
Other log file management:
addMessageToLog(),
captureLog(),
initLogfunction(),
setShowLogMessages(),
writeTableToLog(),
writeToLog()
## Not run: # Save session info to log file saveSessionInfo() ## End(Not run)## Not run: # Save session info to log file saveSessionInfo() ## End(Not run)
This function prepares plot and table objects by setting their export attributes, such as caption and footnote lines, which will be used when exporting through the 'PlotManager' class.
setExportAttributes( object, caption = NULL, footNoteLines = NULL, exportArguments = NULL )setExportAttributes( object, caption = NULL, footNoteLines = NULL, exportArguments = NULL )
object |
An object (e.g., a plot or table) for which export attributes will be set. |
caption |
A character string specifying the caption for the object. If NULL, no caption will be set. |
footNoteLines |
A character vector specifying footnote lines for the object. If, no footnote lines will be set. |
exportArguments |
A list of additional arguments such as width or height passed on to 'ospsuite.plots::exportPlot'. |
The modified object with the specified export attributes set.
This function takes a data.table and converts the first letter of all column names to lowercase.
setHeadersToLowerCase(dt)setHeadersToLowerCase(dt)
dt |
A data.table object whose column names need to be converted to lowercase. |
The modified data.table with updated column names.
Other function to read from and write to xlsx:
splitInputs(),
xlsxAddDataUsingTemplate(),
xlsxAddSheet(),
xlsxCloneAndSet(),
xlsxReadData(),
xlsxWriteData()
dt <- data.table::data.table(FirstName = c("John", "Jane"), LastName = c("Doe", "Smith")) dtLower <- setHeadersToLowerCase(dt) print(names(dtLower)) # Result: c("firstname", "lastname")dt <- data.table::data.table(FirstName = c("John", "Jane"), LastName = c("Doe", "Smith")) dtLower <- setHeadersToLowerCase(dt) print(names(dtLower)) # Result: c("firstname", "lastname")
Function to switch the display of log messages on the console on and off
setShowLogMessages(verbose = TRUE)setShowLogMessages(verbose = TRUE)
verbose |
boolean, if true log message will be shown |
Other log file management:
addMessageToLog(),
captureLog(),
initLogfunction(),
saveSessionInfo(),
writeTableToLog(),
writeToLog()
This function sets up a configuration sheet for virtual twin populations based on the provided project configuration and observed data.
setupVirtualTwinPopConfig(projectConfiguration, dataObserved, groups = NULL)setupVirtualTwinPopConfig(projectConfiguration, dataObserved, groups = NULL)
projectConfiguration |
A list containing project configuration details, including file paths for populations and scenarios. |
dataObserved |
A data object containing observed data, which may be of class "DataCombined". |
groups |
A character vector of group names to filter the virtual twin population. Defaults to NULL. |
Returns NULL invisibly if no groups are available for virtual twin population creation. Modifies the workbook specified in projectConfiguration.
Other population export:
exportRandomPopulations(),
exportVirtualTwinPopulations()
Sets options for a reporting frame work workflow.
setWorkflowOptions(isValidRun = NULL)setWorkflowOptions(isValidRun = NULL)
isValidRun |
A logical value indicating if the run is valid. If TRUE, options are set for a valid run; if FALSE, options are set for an invalid run. |
This function configures options for a reporting framework workflow, which is typically applied in two distinct phases:
1. Exploratory Analysis: This phase involves preparation of outputs that are not yet qualified. In this case: - Watermarks are not applied. - Helper functions for building configuration tables are allowed.
2. Production of Final Output: This phase involves generating the "final" output (a valid run). In this case: - Figures should not have watermarks. - Functions that manipulate inputs are not allowed. - The workflow will stop if an error occurs during execution.
Relevant Options:
- 'ospsuite.plots.watermark_enabled': Set to TRUE when 'isValidRun' is FALSE to display watermarks on figures, and FALSE when 'isValidRun' is TRUE.
- 'OSPSuite.RF.skipFailingPlots': Set to TRUE when 'isValidRun' is FALSE to skip plots that fail to generate, and FALSE when 'isValidRun' is TRUE.
- 'OSPSuite.RF.stopHelperFunction': Set to TRUE when 'isValidRun' is TRUE to stop the execution of helper functions during valid runs.
Other project initialization:
ProjectConfigurationRF,
createProjectConfiguration(),
getQCpassedEnvironmentVariable(),
initProject()
This function takes an original vector as input and splits its elements by comma.
splitInputs(originalVector)splitInputs(originalVector)
originalVector |
The original vector to be split. |
A vector containing the split elements.
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
xlsxAddDataUsingTemplate(),
xlsxAddSheet(),
xlsxCloneAndSet(),
xlsxReadData(),
xlsxWriteData()
## Not run: originalVector <- c("group1, group2", "group3") splitInputs(originalVector) # Result: c('group1', 'group2', 'group3') ## End(Not run)## Not run: originalVector <- c("group1, group2", "group3") splitInputs(originalVector) # Result: c('group1', 'group2', 'group3') ## End(Not run)
Manages the creation and writing test project, which can be used for this package or packages which use the reporting framework as base to build a test project
ospsuite.utils::Printable -> TestProjectBuilder
rootDirectoryroot directory of test project. This function synchronizes files from one directory to another, copying only the files that are not already present. This function updates the display names for scenarios and output paths in the project configuration.
new()
Initialize a new instance of the class.
TestProjectBuilder$new()
iniTestProject()
A short description...
This function initializes the project structure and configuration for the test project.
TestProjectBuilder$iniTestProject(rootDirectory, verbose = FALSE)
rootDirectoryA character string specifying the root directory for the test project.
verboseA logical value indicating whether to print messages about the process.
A ProjectConfiguration object containing the details of the initialized project.
setupRandomPopulations()
This function sets up populations for the test project by copying necessary files and exporting defined populations.
TestProjectBuilder$setupRandomPopulations( projectConfiguration, populationNames, writeTestData = FALSE, templateDir = NULL )
projectConfigurationA ProjectConfiguration object containing the project configuration details.
populationNamesA character vector of population names to be copied.
writeTestDataA logical value indicating whether newly created test data should be filed to the inst directory of the package.
templateDircharacter string specifying the installation directory for the package.
NULL
setupSimulations()
This function sets up simulations for the test project by synchronizing necessary directories and running initialized scenarios to calculate pharmacokinetic (PK) parameters.
TestProjectBuilder$setupSimulations( projectConfiguration, scenarioList, writeTestData, templateDir = NULL )
projectConfigurationA ProjectConfiguration object containing the project configuration details.
scenarioListA list of scenarios initialized for the project.
writeTestDataA logical value indicating whether newly created test data should be filed to the inst directory of the package.
templateDirA character string specifying the installation directory for the package.
A list containing the results from running the scenarios. Set Up Sensitivity Analysis
This function sets up sensitivity analysis for the test project based on the defined scenarios.
setUpSensitivity()
TestProjectBuilder$setUpSensitivity( projectConfiguration, scenarioList, scenarioName, writeTestData, parameterList, sensitivitySheet = "smallSelection", templateDir = NULL )
projectConfigurationA ProjectConfiguration object containing project configuration details.
scenarioListA list of scenarios initialized for the project.
scenarioNameThe name of the scenario used for sensitivity
writeTestDataA logical value indicating whether newly created test data should be filed to the inst directory of the package.
parameterListA named list where each name corresponds to a parameter in the Excel sheet, and each value is the new value to set for that parameter.
sensitivitySheetName of sheet with parameter selection
templateDirA character string specifying the installation directory for the package.
A ProjectConfiguration object containing the updated project configuration.
addRandomTPData()
This function adds random time profile data to the test project for selected individuals.
TestProjectBuilder$addRandomTPData(
projectConfiguration,
scenarioResults,
ids,
timePoints = c(15, 30, 45, 60, 90, c(3, 6, 9, 12, 18, 24) * 60),
outputPathIds = c("Plasma", "CYP3A4total", "CYP3A4Liver"),
sdShift = 0.05,
lloqValue = 0.1
)projectConfigurationA ProjectConfiguration object containing project configuration details.
scenarioResultsList of scenario results.
idsA vector of individual IDs to include in the random data.
timePointsA numeric vector specifying the time points at which to generate data (default is c(15, 30, 45, 60, 90, c(3, 6, 9, 12, 18, 24) * 60)).
outputPathIdsA character vector specifying the output path IDs to include in the random data (default is c('Plasma', 'CYP3A4total', 'CYP3A4Liver')).
sdShiftA numeric value indicating the standard deviation shift applied to the random values (default is 0.05).
lloqValueA numeric value representing the lower limit of quantification (default is 0.1).
Invisible NULL. This function adds random pharmacokinetic (PK) data to the test project, including shifting values and calculating statistics for selected individuals.
addRandomPKData()
TestProjectBuilder$addRandomPKData(
projectConfiguration,
pkParameterDT,
ids,
outputPathIds = c("Plasma", "CYP3A4total", "CYP3A4Liver"),
sdShift = 0.05
)projectConfigurationA ProjectConfiguration object containing project configuration details.
pkParameterDTA data.table containing PK parameters and values.
idsA vector of individual IDs to include in the random data.
outputPathIdsA character vector specifying the output path IDs to include in the random data (default is c('Plasma', 'CYP3A4total', 'CYP3A4Liver')).
sdShiftA numeric value indicating the standard deviation shift applied to the random values (default is 0.05).
Invisible NULL.
mockManualEditingsCleanup()
This function cleans up the project configuration files by clearing existing data from relevant Excel sheets.
TestProjectBuilder$mockManualEditingsCleanup(projectConfiguration)
projectConfigurationA ProjectConfiguration object containing project configuration details.
NULL
mockManualEditingsPopulation()
This function adds biometric ranges for virtual pediatric and one adult populations to the configuration files
TestProjectBuilder$mockManualEditingsPopulation(
projectConfiguration,
randomPops = data.table(populationName = c("adults", "toddler", "children",
"school-children", "adolescents"), species = "Human", population =
"European_ICRP_2002", numberOfIndividuals = 100, proportionOfFemales = 50, ageMin =
c(20, 0.5, 2, 6, 12), ageMax = c(40, 2, 6, 12, 18), weightUnit = "kg", heightUnit =
"cm", bMIUnit = "kg/m²", `protein Ontogenies` = "CYP3A4:CYP3A4, UGT1A4:UGT1A4")
)projectConfigurationA ProjectConfiguration object containing project configuration details.
randomPopsdata.table with content for sheet Demographics in Population.xlsx
NULL
mockManualEditingsScenario()
This function sets up scenarios based on the defined populations and adds PK Parameters and output paths to the project configuration.
TestProjectBuilder$mockManualEditingsScenario( projectConfiguration, dtTestScenarios, pKParameter = NULL )
projectConfigurationA ProjectConfiguration object containing project configuration details.
dtTestScenarios'data.table' with content for scenarios
pKParametervector with pkParameter sheets
NULL
mockManualEditingsPKParameter()
This function adds PK parameters to the project configuration based on templates.
TestProjectBuilder$mockManualEditingsPKParameter(projectConfiguration)
projectConfigurationA ProjectConfiguration object containing project configuration details.
NULL
mockManualEditingsIndividuals()
This function adjust the bio-metrics with in individuals and exports virtual twin populations.
TestProjectBuilder$mockManualEditingsIndividuals(projectConfiguration)
projectConfigurationA 'ProjectConfiguration' object containing project configuration details.
'data.table' with content of sheet 'VirtualTwinPopulation'
mockManualEditingsSensitivity()
This function modifies specific parameters in a given Excel sheet based on the provided parameter list and saves the changes back to the workbook.
TestProjectBuilder$mockManualEditingsSensitivity( projectConfiguration, sheetName, parameterList )
projectConfigurationA list containing project configuration details, including the path to the sensitivity file.
sheetNameA string representing the name of the sheet in the Excel workbook that will be edited.
parameterListA named list where each name corresponds to a parameter in the Excel sheet, and each value is the new value to set for that parameter.
NULL This function is called for its side effects (i.e., modifying the Excel file).
clone()
The objects of this class are cloneable with this method.
TestProjectBuilder$clone(deep = FALSE)
deepWhether to make a deep clone.
enumeration keys for Time range shortcut
TIMERANGETIMERANGE
An object of class list of length 3.
Other enumerations:
BIOMETRICUNITS,
DATACLASS,
EXPORTDIR
This function updates the Data Groups sheet in an Excel workbook based on a provided data table. It reads existing data group IDs, merges them with new data, and ensures that the identifiers remain unique.
updateDataGroupId(projectConfiguration, dataDT)updateDataGroupId(projectConfiguration, dataDT)
projectConfiguration |
An object of class 'ProjectConfiguration' containing configuration details |
dataDT |
A 'data.table' containing the new data to be added to the Data Groups sheet. It must have columns that can be matched with existing identifiers, including "group", "studyId", and "studyArm". |
The function loads the existing Data Groups from the specified Excel workbook, selects relevant columns from the input data, and appends new entries while maintaining the uniqueness of the identifiers. The updated data is then written back to the workbook.
NULL This function updates the Excel workbook in place and does not return a value. It is called for its side effects.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateOutputPathId(),
validateObservedData()
This function updates the Outputs sheet in an Excel workbook based on a provided data table, ensuring that output path IDs remain unique.
updateOutputPathId(projectConfiguration, dataDT)updateOutputPathId(projectConfiguration, dataDT)
projectConfiguration |
An object of class 'ProjectConfiguration' containing configuration details. |
dataDT |
A 'data.table' containing new output path IDs to be added to the Outputs sheet. It must include a column named "outputPathId". |
The function loads the existing Output Paths from the specified Excel workbook, extracts unique output path IDs from the input data, and appends them while maintaining uniqueness. The updated data is then written back to the workbook.
NULL This function updates the Excel workbook in place and does not return a value. It is called for its side effects.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateDataGroupId(),
validateObservedData()
check if at least one of the following columns is selected
validateAtleastOneEntry(configTablePlots, columnVector)validateAtleastOneEntry(configTablePlots, columnVector)
configTablePlots |
'data.table' Configuration table without header lines |
columnVector |
vector of columns to check |
validate types of plot configuration tables
validateConfigTablePlots( configTablePlots, charactersWithoutMissing = NULL, charactersWithMissing = NULL, numericColumns = NULL, logicalColumns = NULL, numericRangeColumns = NULL, subsetList = list() )validateConfigTablePlots( configTablePlots, charactersWithoutMissing = NULL, charactersWithMissing = NULL, numericColumns = NULL, logicalColumns = NULL, numericRangeColumns = NULL, subsetList = list() )
configTablePlots |
'data.table' configuration table without header lines |
charactersWithoutMissing |
vector with character columns, where no missing value is allowed |
charactersWithMissing |
vector with character column, where values may missing |
numericColumns |
vector with numeric columns |
logicalColumns |
vector with booleans |
numericRangeColumns |
vector with columns where entries must be evaluate to a numeric of length 2 |
subsetList |
list where each entry is a list: list(cols = 'vector with columns', allowedValues = vector with allowed values) |
Validates the configuration table for distribution vs demographics plots.
validateDistributionVsDemographicsConfig(configTable, scenarioList, ...)validateDistributionVsDemographicsConfig(configTable, scenarioList, ...)
configTable |
A data.table containing the configuration table. |
scenarioList |
List of scenarios |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate plots displaying distribution vs demographics:
addDefaultConfigForHistograms(),
plotDistributionVsDemographics()
This function checks whether specified columns in a data table have consistent values within groups defined by one or more grouping columns. If any column contains more than one unique value within a group, an error is raised.
validateGroupConsistency(dt, valueColumns, groupingColumns = "plotName")validateGroupConsistency(dt, valueColumns, groupingColumns = "plotName")
dt |
A data.table or data.frame containing the data to be validated. |
valueColumns |
A character vector of column names to check for consistency. |
groupingColumns |
A character vector of column names that define the groups. Default is 'plotName'. |
Returns NULL (invisible) if all checks pass. Raises an error if any value column contains inconsistent values within a group.
checks if config table header and plot rows are strict separated
validateHeaders(configTable)validateHeaders(configTable)
configTable |
'data.table' configuration table to check |
configuration table without header lines
Validates the configuration table for histogram plots.
validateHistogramsConfig(configTable, ...)validateHistogramsConfig(configTable, ...)
configTable |
A data.table containing the configuration table. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate histograms:
addDefaultConfigForDistributionsVsDemographics(),
plotHistograms()
Validates numeric range columns in the provided data frame.
validateNumericVectorColumns(columns, data, ...)validateNumericVectorColumns(columns, data, ...)
columns |
A vector of column names to validate. |
data |
A data frame containing the columns to validate. |
... |
additionally parameters parsed to checkmate::assertNumeric |
Checks the integrity and validity of observed data in a 'data.table'. This function verifies the presence of required attributes, checks for duplicates, and ensures that there are no missing or empty values in the relevant columns. Additionally, it checks for ambiguities in the Y unit and validates error type columns.
validateObservedData(dataDT, dataClassType)validateObservedData(dataDT, dataClassType)
dataDT |
A 'data.table' containing observed data with the following relevant columns: - 'individualId': Unique identifier for individuals. - 'group': Group identifier. - 'outputPathId': Identifier for output paths. - 'xValues': Values for the x-axis. - 'yUnit': Unit for the Y values. - 'yErrorType': Type of error for Y values (optional). - 'yErrorValues': Values representing errors (optional). - 'yMin', 'yMax': Minimum and maximum Y values (optional). - 'lloq': Lower limit of quantification (optional). - 'nBelowLLOQ': Count of values below the lower limit of quantification (optional). |
dataClassType |
A string indicating the type of data class (e.g., "timeprofile" or "pkParameter"). |
The function performs several checks, including: - Ensuring all data columns have the appropriate attributes. - Verifying that the data is unique based on specified identifier columns. - Checking for NA or empty values in all relevant columns. - Ensuring that the Y unit is consistent across output paths. - Validating the presence of necessary columns based on the Y error type.
NULL This function performs checks and stops execution if any validation fails. It does not return a value.
Other observed data processing:
addBiometricsToConfig(),
aggregateObservedDataGroups(),
convertDataCombinedToDataTable(),
convertDataTableToDataCombined(),
readObservedDataByDictionary(),
updateDataGroupId(),
updateOutputPathId()
Validates the configuration table for PK box-and-whisker plots.
validatePKBoxwhiskerConfig(configTable, pkParameterDT, ...)validatePKBoxwhiskerConfig(configTable, pkParameterDT, ...)
configTable |
A data.table containing the configuration table. |
pkParameterDT |
A data.table containing PK parameter data. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate box whisker plots:
addDefaultConfigForPKBoxwhsikerPlots(),
plotPKBoxwhisker()
Validates the configuration for PK forest plots with absolute values and variance.
validatePKForestAggregatedAbsoluteValuesConfig(configTable, pkParameterDT, ...)validatePKForestAggregatedAbsoluteValuesConfig(configTable, pkParameterDT, ...)
configTable |
A data.table containing the configuration table. |
pkParameterDT |
A data.table containing PK parameter data. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
Validates the configuration for PK forest plots with ratios and variance.
validatePKForestAggregatedRatiosConfig(configTable, pkParameterDT, ...)validatePKForestAggregatedRatiosConfig(configTable, pkParameterDT, ...)
configTable |
A data.table containing the configuration table. |
pkParameterDT |
A data.table containing PK parameter data. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig()
Validates the configuration for PK forest plots with absolute values and confidence intervals.
validatePKForestPointEstimateOfAbsoluteValuesConfig( configTable, pkParameterDT, ... )validatePKForestPointEstimateOfAbsoluteValuesConfig( configTable, pkParameterDT, ... )
configTable |
A data.table containing the configuration table. |
pkParameterDT |
A data.table containing PK parameter data. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfRatiosConfig()
Validates the configuration for PK forest plots with ratios and confidence intervals.
validatePKForestPointEstimateOfRatiosConfig(configTable, pkParameterDT, ...)validatePKForestPointEstimateOfRatiosConfig(configTable, pkParameterDT, ...)
configTable |
A data.table containing the configuration table. |
pkParameterDT |
A data.table containing PK parameter data. |
... |
Additional arguments for validation. |
NULL (invisible).
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validateSensitivityConfig(),
validateTimeProfilesConfig()
Other functions to generate forest plots:
addDefaultConfigForPKForestPlots(),
plotPKForestAggregatedAbsoluteValues(),
plotPKForestAggregatedRatios(),
plotPKForestPointEstimateOfAbsoluteValues(),
plotPKForestPointEstimateOfRatios(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig()
This function checks the headers of the configuration table, validates output IDs and data group IDs for plotting, and ensures the configuration adheres to specified criteria. It also checks for file existence in the output folder.
validateSensitivityConfig(configTable, ...)validateSensitivityConfig(configTable, ...)
configTable |
A data.table containing the configuration for sensitivity analysis. |
... |
Additional arguments passed to other functions. |
A validated data frame containing the configuration table for sensitivity plots.
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateTimeProfilesConfig()
Validation of config table for time profiles plots
validateTimeProfilesConfig( configTable, dataObserved = NULL, scenarioResults, ... )validateTimeProfilesConfig( configTable, dataObserved = NULL, scenarioResults, ... )
configTable |
Plot configuration table. |
dataObserved |
A 'data.table' (formatted as produced by 'readObservedDataByDictionary') or 'DataCombined' object containing the observed data to be plotted. |
scenarioResults |
A list containing simulated scenario results. |
... |
Additional arguments passed to 'ospsuite.plots::plotTimeprofile'. |
Other plot configuration validation function:
validateDistributionVsDemographicsConfig(),
validateHistogramsConfig(),
validatePKBoxwhiskerConfig(),
validatePKForestAggregatedAbsoluteValuesConfig(),
validatePKForestAggregatedRatiosConfig(),
validatePKForestPointEstimateOfAbsoluteValuesConfig(),
validatePKForestPointEstimateOfRatiosConfig(),
validateSensitivityConfig()
write a table to the logfile
writeTableToLog(dt, filename = "run.log")writeTableToLog(dt, filename = "run.log")
dt |
table to log |
filename |
filename of log |
Other log file management:
addMessageToLog(),
captureLog(),
initLogfunction(),
saveSessionInfo(),
setShowLogMessages(),
writeToLog()
The 'writeToLog' function is used to append log messages to a log file. The path for the logfile has to be initialized by the function initLogfile
writeToLog(type, msg, filename = NULL)writeToLog(type, msg, filename = NULL)
type |
The type of message (e.g., Error, Info). |
msg |
The message to be logged. |
filename |
The name of the log file. |
Other log file management:
addMessageToLog(),
captureLog(),
initLogfunction(),
saveSessionInfo(),
setShowLogMessages(),
writeTableToLog()
## Not run: # Write a log message writeToLog(type = "Info", msg = "This is an information message", filename = "run.log") ## End(Not run)## Not run: # Write a log message writeToLog(type = "Info", msg = "This is an information message", filename = "run.log") ## End(Not run)
If the template does not exist in the configuration file in the project directory, it is taken from the configuration file of the package installation. In this case, formats are not preserved.
xlsxAddDataUsingTemplate( wb, templateSheet, sheetName, dtNewData, templateXlsx = "Plots.xlsx" )xlsxAddDataUsingTemplate( wb, templateSheet, sheetName, dtNewData, templateXlsx = "Plots.xlsx" )
wb |
Current configuration file. |
templateSheet |
Name of the template sheet. |
sheetName |
Name of the new sheet. |
dtNewData |
A 'data.table' with new data. |
templateXlsx |
A character string specifying the template xlsx file name (default is "Plots.xlsx"). |
The current configuration file with the added sheet.
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
splitInputs(),
xlsxAddSheet(),
xlsxCloneAndSet(),
xlsxReadData(),
xlsxWriteData()
## Not run: wb <- loadWorkbook("config.xlsx") newData <- data.table(Name = c("Gina", "Hank"), Age = c(29, 33)) xlsxAddDataUsingTemplate(wb, "TemplateSheet", "NewDataSheet", newData) ## End(Not run)## Not run: wb <- loadWorkbook("config.xlsx") newData <- data.table(Name = c("Gina", "Hank"), Age = c(29, 33)) xlsxAddDataUsingTemplate(wb, "TemplateSheet", "NewDataSheet", newData) ## End(Not run)
This function wraps 'openxlsx::addWorksheet' and adds data to the newly created sheet. If the sheet already exists, it issues a warning and clears the existing content.
xlsxAddSheet(wb, sheetName, dt)xlsxAddSheet(wb, sheetName, dt)
wb |
A workbook object created by 'openxlsx::loadWorkbook()'. |
sheetName |
A character string specifying the name of the sheet to add. |
dt |
A 'data.table' containing the data to be written to the new sheet. |
An invisible NULL value. The function performs an action (adding a sheet)
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
splitInputs(),
xlsxAddDataUsingTemplate(),
xlsxCloneAndSet(),
xlsxReadData(),
xlsxWriteData()
## Not run: library(openxlsx) wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Alice", "Bob"), Age = c(30, 25)) xlsxAddSheet(wb, "NewSheet", data) ## End(Not run)## Not run: library(openxlsx) wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Alice", "Bob"), Age = c(30, 25)) xlsxAddSheet(wb, "NewSheet", data) ## End(Not run)
This function wraps 'openxlsx::cloneWorksheet' but sets new content in the cloned sheet.
xlsxCloneAndSet(wb, clonedSheet, sheetName, dt)xlsxCloneAndSet(wb, clonedSheet, sheetName, dt)
wb |
A workbook object created by 'openxlsx::loadWorkbook()'. |
clonedSheet |
A character string specifying the name of the sheet to clone. |
sheetName |
A character string specifying the name of the new sheet. |
dt |
A 'data.table' with new content. |
An invisible NULL value. The function performs an action (clone a sheet)
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
splitInputs(),
xlsxAddDataUsingTemplate(),
xlsxAddSheet(),
xlsxReadData(),
xlsxWriteData()
## Not run: wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Eve", "Frank"), Age = c(22, 35)) xlsxCloneAndSet(wb, "ExistingSheet", "ClonedSheet", data) ## End(Not run)## Not run: wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Eve", "Frank"), Age = c(22, 35)) xlsxCloneAndSet(wb, "ExistingSheet", "ClonedSheet", data) ## End(Not run)
This function wraps 'openxlsx::read.xlsx' and returns the data as a 'data.table'.
xlsxReadData( wb, sheetName = 1, skipDescriptionRow = FALSE, alwaysCharacter = c("Group", "Id$", "Ids$"), emptyAsNA = TRUE, convertHeaders = TRUE )xlsxReadData( wb, sheetName = 1, skipDescriptionRow = FALSE, alwaysCharacter = c("Group", "Id$", "Ids$"), emptyAsNA = TRUE, convertHeaders = TRUE )
wb |
A workbook object or a character string specifying the path to the xlsx file. |
sheetName |
A character string specifying the name of the sheet to read. |
skipDescriptionRow |
A logical value or an integer indicating whether the first row (or rows, if an integer) should be treated as description rows and skipped during reading. When set to TRUE, the first row is skipped; when set to a positive integer, that number of rows will be skipped. The 'Comment' column is also excluded from the resulting data table. |
alwaysCharacter |
A character vector with column names or regex patterns that should be returned as character (typically identifiers). |
emptyAsNA |
A logical value. If TRUE, empty strings in character columns are converted to NA. If FALSE NA is returned as empty string. Numeric columns Return always NA |
convertHeaders |
A logical value. If TRUE, column names are converted to start with a lowercase letter. |
A 'data.table' containing the sheet data.
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
splitInputs(),
xlsxAddDataUsingTemplate(),
xlsxAddSheet(),
xlsxCloneAndSet(),
xlsxWriteData()
## Not run: wb <- loadWorkbook("example.xlsx") data <- xlsxReadData(wb, "DataSheet", skipDescriptionRow = 1) print(data) ## End(Not run)## Not run: wb <- loadWorkbook("example.xlsx") data <- xlsxReadData(wb, "DataSheet", skipDescriptionRow = 1) print(data) ## End(Not run)
This function wraps 'openxlsx::writeData', but deletes all current content before writing new data.
xlsxWriteData(wb, sheetName, dt)xlsxWriteData(wb, sheetName, dt)
wb |
A workbook object created by 'openxlsx::loadWorkbook()'. |
sheetName |
A character string specifying the name of the sheet where data will be written. |
dt |
A 'data.table' to write. |
An invisible NULL value. The function performs an action (adding data to a sheet)
Other function to read from and write to xlsx:
setHeadersToLowerCase(),
splitInputs(),
xlsxAddDataUsingTemplate(),
xlsxAddSheet(),
xlsxCloneAndSet(),
xlsxReadData()
## Not run: wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Charlie", "Dana"), Age = c(28, 32)) xlsxWriteData(wb, "ExistingSheet", data) ## End(Not run)## Not run: wb <- loadWorkbook("example.xlsx") data <- data.table(Name = c("Charlie", "Dana"), Age = c(28, 32)) xlsxWriteData(wb, "ExistingSheet", data) ## End(Not run)