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.

Glimpse at the xpdb

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)

Access the model code

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

Access the output data

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

Access the run files

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

Access the parameter estimates

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)

Access the run summary

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


guiastrennec/ggxpose documentation built on Feb. 3, 2024, 7:36 a.m.