library(xpose) options(width = 100) xpdb <- xpdb_ex_pk knitr::opts_chunk$set(out.width = '75%', comment = '', message = FALSE)
The xpose package was designed as a standardized interface between model outputs and R. Hence model output files can easily be imported in R and used to summarize data or create plots.
The files attached to an xpdb object can be displayed to the console simply by writing the xpdb name to the console or by using the print()
function. Any of these files can be accessed from the xpdb using one of the functions listed below.
xpdb # or print(xpdb)
The get_code()
function can be used to access the parsed model code from the xpdb. This code was used to create the summary and find table names. The parsed code can be used to get additional information about the run. If the argument .problem
is specified a subset of the code can be returned based on $PROBLEM
.
Note that general code warnings and PsN outputs appended are listed as problem 0.
code <- get_code(xpdb) code
The get_data()
function can be used to access the imported table files. Tables can be accessed by table
name or by .problem
. In the latter a single dataset containing all aggregated tables is returned. If more than one table
name or .problem
number is provided a named list is returned.
Note when providing a table name it is not guaranteed that the table will be identical to its file (i.e. the order of the columns may have been changed and tables with FIRSTONLY
will no longer be deduplicated).
data <- get_data(xpdb, table = 'cotab001') data
The get_file()
function can be used to access the imported output files. Files can be accessed by file
name, by .problem
, .subprob
and/or .method
. If more than one file
name, .problem
, .subprob
, or .method
is provided a named list is returned.
file <- get_file(xpdb, file = 'run001.ext') file
The get_prm()
function can be used to access the parameter estimates. To get a nice parameter table printed to the console use the function prm_table()
instead. The arguments .problem
, .subprob
and .method
can be used to select the parameter estimates to output.
# Raw output for editing prm <- get_prm(xpdb, digits = 4) prm # Nicely formated table prm_table(xpdb, digits = 4)
The get_summary()
function can be used to access the generated run summary from which the template_titles
. If the argument .problem
is specified a subset of the summary can be returned based on $PROBLEM
.
Note that general summary information are listed as problem 0.
run_sum <- get_summary(xpdb, .problem = 0) run_sum
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.