Converts a SimulationResults
objects to a data.frame
Source: R/utilities-simulation-results.R
simulationResultsToDataFrame.Rd
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 callingrunSimulation
on aSimulation
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 isNULL
(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 <- runSimulation(sim)
# convert to a dataframe
simulationResultsToDataFrame(results)
#> paths IndividualId Time simulationValues unit dimension TimeUnit
#> 1 Organism|Liver|A 0 0 30.000000 µmol Amount min
#> 2 Organism|Liver|A 0 15 25.820301 µmol Amount min
#> 3 Organism|Liver|A 0 30 22.223164 µmol Amount min
#> 4 Organism|Liver|A 0 45 19.129129 µmol Amount min
#> 5 Organism|Liver|A 0 60 16.467295 µmol Amount min
#> 6 Organism|Liver|A 0 75 14.176212 µmol Amount min
#> 7 Organism|Liver|A 0 90 12.203826 µmol Amount min
#> 8 Organism|Liver|A 0 105 10.505752 µmol Amount min
#> 9 Organism|Liver|A 0 120 9.043887 µmol Amount min
#> 10 Organism|Liver|A 0 135 7.785418 µmol Amount min
#> 11 Organism|Liver|A 0 150 6.702065 µmol Amount min
#> 12 Organism|Liver|A 0 165 5.769464 µmol Amount min
#> 13 Organism|Liver|A 0 180 4.966637 µmol Amount min
#> 14 Organism|Liver|A 0 195 4.275526 µmol Amount min
#> 15 Organism|Liver|A 0 210 3.680582 µmol Amount min
#> 16 Organism|Liver|A 0 225 3.168425 µmol Amount min
#> 17 Organism|Liver|A 0 240 2.727535 µmol Amount min
#> 18 Organism|Liver|A 0 255 2.347995 µmol Amount min
#> 19 Organism|Liver|A 0 270 2.021268 µmol Amount min
#> 20 Organism|Liver|A 0 285 1.740006 µmol Amount min
#> 21 Organism|Liver|A 0 300 1.497881 µmol Amount min
#> 22 Organism|Liver|B 0 0 5.000000 µmol Amount min
#> 23 Organism|Liver|B 0 15 9.179699 µmol Amount min
#> 24 Organism|Liver|B 0 30 12.776835 µmol Amount min
#> 25 Organism|Liver|B 0 45 15.870872 µmol Amount min
#> 26 Organism|Liver|B 0 60 18.532705 µmol Amount min
#> 27 Organism|Liver|B 0 75 20.823788 µmol Amount min
#> 28 Organism|Liver|B 0 90 22.796175 µmol Amount min
#> 29 Organism|Liver|B 0 105 24.494247 µmol Amount min
#> 30 Organism|Liver|B 0 120 25.956112 µmol Amount min
#> 31 Organism|Liver|B 0 135 27.214582 µmol Amount min
#> 32 Organism|Liver|B 0 150 28.297935 µmol Amount min
#> 33 Organism|Liver|B 0 165 29.230536 µmol Amount min
#> 34 Organism|Liver|B 0 180 30.033363 µmol Amount min
#> 35 Organism|Liver|B 0 195 30.724474 µmol Amount min
#> 36 Organism|Liver|B 0 210 31.319418 µmol Amount min
#> 37 Organism|Liver|B 0 225 31.831575 µmol Amount min
#> 38 Organism|Liver|B 0 240 32.272465 µmol Amount min
#> 39 Organism|Liver|B 0 255 32.652004 µmol Amount min
#> 40 Organism|Liver|B 0 270 32.978733 µmol Amount min
#> 41 Organism|Liver|B 0 285 33.259995 µmol Amount min
#> 42 Organism|Liver|B 0 300 33.502117 µmol Amount min
#> 43 Organism|A 0 0 40.000000 µmol Amount min
#> 44 Organism|A 0 15 34.427067 µmol Amount min
#> 45 Organism|A 0 30 29.630886 µmol Amount min
#> 46 Organism|A 0 45 25.505505 µmol Amount min
#> 47 Organism|A 0 60 21.956394 µmol Amount min
#> 48 Organism|A 0 75 18.901617 µmol Amount min
#> 49 Organism|A 0 90 16.271769 µmol Amount min
#> 50 Organism|A 0 105 14.007668 µmol Amount min
#> 51 Organism|A 0 120 12.058517 µmol Amount min
#> 52 Organism|A 0 135 10.380558 µmol Amount min
#> 53 Organism|A 0 150 8.936086 µmol Amount min
#> 54 Organism|A 0 165 7.692618 µmol Amount min
#> 55 Organism|A 0 180 6.622183 µmol Amount min
#> 56 Organism|A 0 195 5.700700 µmol Amount min
#> 57 Organism|A 0 210 4.907443 µmol Amount min
#> 58 Organism|A 0 225 4.224566 µmol Amount min
#> 59 Organism|A 0 240 3.636713 µmol Amount min
#> 60 Organism|A 0 255 3.130660 µmol Amount min
#> 61 Organism|A 0 270 2.695024 µmol Amount min
#> 62 Organism|A 0 285 2.320008 µmol Amount min
#> 63 Organism|A 0 300 1.997175 µmol Amount min
#> 64 Organism|B 0 0 10.000000 µmol Amount min
#> 65 Organism|B 0 15 15.572932 µmol Amount min
#> 66 Organism|B 0 30 20.369114 µmol Amount min
#> 67 Organism|B 0 45 24.494495 µmol Amount min
#> 68 Organism|B 0 60 28.043606 µmol Amount min
#> 69 Organism|B 0 75 31.098383 µmol Amount min
#> 70 Organism|B 0 90 33.728233 µmol Amount min
#> 71 Organism|B 0 105 35.992332 µmol Amount min
#> 72 Organism|B 0 120 37.941483 µmol Amount min
#> 73 Organism|B 0 135 39.619442 µmol Amount min
#> 74 Organism|B 0 150 41.063915 µmol Amount min
#> 75 Organism|B 0 165 42.307381 µmol Amount min
#> 76 Organism|B 0 180 43.377815 µmol Amount min
#> 77 Organism|B 0 195 44.299301 µmol Amount min
#> 78 Organism|B 0 210 45.092556 µmol Amount min
#> 79 Organism|B 0 225 45.775433 µmol Amount min
#> 80 Organism|B 0 240 46.363285 µmol Amount min
#> 81 Organism|B 0 255 46.869339 µmol Amount min
#> 82 Organism|B 0 270 47.304977 µmol Amount min
#> 83 Organism|B 0 285 47.679993 µmol Amount min
#> 84 Organism|B 0 300 48.002823 µmol Amount min
#> TimeDimension molWeight
#> 1 Time NA
#> 2 Time NA
#> 3 Time NA
#> 4 Time NA
#> 5 Time NA
#> 6 Time NA
#> 7 Time NA
#> 8 Time NA
#> 9 Time NA
#> 10 Time NA
#> 11 Time NA
#> 12 Time NA
#> 13 Time NA
#> 14 Time NA
#> 15 Time NA
#> 16 Time NA
#> 17 Time NA
#> 18 Time NA
#> 19 Time NA
#> 20 Time NA
#> 21 Time NA
#> 22 Time NA
#> 23 Time NA
#> 24 Time NA
#> 25 Time NA
#> 26 Time NA
#> 27 Time NA
#> 28 Time NA
#> 29 Time NA
#> 30 Time NA
#> 31 Time NA
#> 32 Time NA
#> 33 Time NA
#> 34 Time NA
#> 35 Time NA
#> 36 Time NA
#> 37 Time NA
#> 38 Time NA
#> 39 Time NA
#> 40 Time NA
#> 41 Time NA
#> 42 Time NA
#> 43 Time NA
#> 44 Time NA
#> 45 Time NA
#> 46 Time NA
#> 47 Time NA
#> 48 Time NA
#> 49 Time NA
#> 50 Time NA
#> 51 Time NA
#> 52 Time NA
#> 53 Time NA
#> 54 Time NA
#> 55 Time NA
#> 56 Time NA
#> 57 Time NA
#> 58 Time NA
#> 59 Time NA
#> 60 Time NA
#> 61 Time NA
#> 62 Time NA
#> 63 Time NA
#> 64 Time NA
#> 65 Time NA
#> 66 Time NA
#> 67 Time NA
#> 68 Time NA
#> 69 Time NA
#> 70 Time NA
#> 71 Time NA
#> 72 Time NA
#> 73 Time NA
#> 74 Time NA
#> 75 Time NA
#> 76 Time NA
#> 77 Time NA
#> 78 Time NA
#> 79 Time NA
#> 80 Time NA
#> 81 Time NA
#> 82 Time NA
#> 83 Time NA
#> 84 Time NA