| selectRunParameter {openMpp} | R Documentation |
Select parameter values from model run result
selectRunParameter(dbCon, defRs, runId, paramName)
dbCon |
database connection |
defRs |
model definition: database rows describing model input parameters and output tables |
runId |
id of model run results, must be positive integer |
paramName |
parameter name, i.e.: "sexAge" |
That call return values of input parameter from model run results with id runId.
You must use getModel function in order to find model definition defRs.
Data frame of database rows with parameter dimensions and values:
sub_id |
parameter sub-value id or zero if parameter has no sub-values |
dim0,...,dimN |
dimension items enum ids (not returned if rank is zero) |
value |
parameter value |
To run examples you must have modelOne database modelOne.sqlite in current directory
amc1999
OpenM++ documentation: https://github.com/openmpp/openmpp.github.io/wiki
getModel
getFirstRunId
getLastRunId
selectRunAccumulator
selectRunOutputValue
#
# connect to database
#
theDb <- dbConnect(RSQLite::SQLite(), "modelOne.sqlite", synchronous = "full")
invisible(dbGetQuery(theDb, "PRAGMA busy_timeout = 86400")) # recommended
# get definition for "modelOne" model
#
# use model name only to identify the model
# if there are multiple versions of the model in database
# then first one is selected: where model id = min(model_id) for "modelOne"
#
defRs <- getModel(theDb, "modelOne")
# get first run id of that model
runId <- getFirstRunId(theDb, defRs)
if (runId <= 0L) stop("model run results not found")
# select parameter "ageSex" value from model run results
#
paramValueRs <- selectRunParameter(theDb, defRs, runId, "ageSex")
dbDisconnect(theDb)