selectRunOutputValue {openMpp} | R Documentation |
Select output table expression values from model run result
selectRunOutputValue(dbCon, defRs, runId, tableName, exprName = NA)
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 |
tableName |
output table name, i.e.: "sexAge" |
exprName |
(optional) output table expression name, i.e.: "meas0" if missing or NA then return all expressions |
That call return values of output table expressions from model run results with id runId
.
You can get either value of single expression by specifying it name, i.e.: "meas2"
or all expressions if exprName
argument is missing.
You must use getModel
function in order to find model definition defRs
.
Data frame of database rows with output table expression(s) dimensions and values:
expr_id |
expression number (zero based) |
dim0,...,dimN |
dimension items enum ids (not returned if rank is zero) |
value |
output table expression(s) 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
selectRunParameter
# # 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 output table expression(s) value of "salarySex" from model run results # expr2_ValueRs <- selectRunOutputValue(theDb, defRs, runId, "salarySex", "expr2") allExprValueRs <- selectRunOutputValue(theDb, defRs, runId, "salarySex") dbDisconnect(theDb)