simulationResultsToDataFrame: Converts a 'SimulationResults' objects to a data.frame

View source: R/utilities-simulation-results.R

simulationResultsToDataFrameR Documentation

Converts a SimulationResults objects to a data.frame

Description

Converts a SimulationResults objects to a data.frame

Usage

simulationResultsToDataFrame(
  simulationResults,
  quantitiesOrPaths = NULL,
  population = NULL,
  individualIds = NULL
)

simulationResultsToTibble(
  simulationResults,
  quantitiesOrPaths = NULL,
  population = NULL,
  individualIds = NULL
)

Arguments

simulationResults

Object of type SimulationResults produced by calling runSimulations on a Simulation object.

quantitiesOrPaths

Quantity instances (element or vector) typically retrieved using getAllQuantitiesMatching or quantity path (element or vector of strings) for which the results are to be returned. (optional) When providing the paths, only absolute full paths are supported (i.e., no matching with '*' possible). If quantitiesOrPaths is NULL (default value), returns the results for all output defined in the results.

population

population used to calculate the simulationResults (optional). This is used only to add the population covariates to the resulting data table.

individualIds

numeric IDs of individuals for which the results should be extracted. By default, all individuals from the results are considered. If the individual with the provided ID is not found, the ID is ignored.

Value

SimulationResults object as data.frame with columns IndividualId, Time, paths, simulationValues, unit, dimension, TimeUnit.

Examples

library(ospsuite)

simPath <- system.file("extdata", "simple.pkml", package = "ospsuite")
sim <- loadSimulation(simPath)

# Running an individual simulation
# results is an instance of `SimulationResults`
results <- runSimulations(sim)[[1]]

# convert to a dataframe
simulationResultsToDataFrame(results)

Open-Systems-Pharmacology/OSPSuite-R documentation built on Feb. 14, 2025, 4:48 p.m.