Access model output table data from an xpdb object.

get_data(xpdb, table = NULL, .problem = NULL, quiet)

Arguments

xpdb

An xpose_data object from which the model output file data will be extracted.

table

Name of the output table to be extracted from the xpdb e.g. 'sdtab001'. Alternative to the `.problem` argument.

.problem

Accesses all tables from the specified problem. Alternative to the `table` argument.

quiet

Logical, if FALSE messages are printed to the console.

Value

By default returns data from the last estimation problem. If only simulation problems are present then the data from last simulation will be returned instead. Object returned as tibble for single tables/problems or a named list for multiple tables/problems.

Examples

# By table name
sdtab <- get_data(xpdb_ex_pk, 'sdtab001')
sdtab
#> # A tibble: 550 × 18
#>    ID     DOSE   AMT    SS    II  TIME   TAD IPRED   CWRES CPRED   IWRES  EVID
#>    <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl> <dbl>   <dbl> <dbl>
#>  1 110     200   100     0     0   0     0   0      0      0      0          1
#>  2 110     200     0     0     0   1     1   0.214 -2.83   0.584  2.40       0
#>  3 110     200     0     0     0   1.5   1.5 0.296 -1.62   0.737  1.03       0
#>  4 110     200     0     0     0   2     2   0.349  1.10   0.790 -1.71       0
#>  5 110     200     0     0     0   4     4   0.392  0.585  0.588 -0.861      0
#>  6 110     200     0     0     0   6     6   0.329 -0.0262 0.304  0.0457     0
#>  7 110     200     0     0     0   8     8   0.249  0.0940 0.127  0.0132     0
#>  8 112     200   100     0     0   0     0   0      0      0      0          1
#>  9 112     200     0     0     0   0.5   0.5 0.556  0.0341 0.627 -0.275      0
#> 10 112     200     0     0     0   1     1   0.712 -0.417  0.788  0.163      0
#> # ℹ 540 more rows
#> # ℹ 6 more variables: A1 <dbl>, A2 <dbl>, DV <dbl>, PRED <dbl>, RES <dbl>,
#> #   WRES <dbl>

# By problem
tables <- get_data(xpdb_ex_pk, .problem = 1)
tables
#> # A tibble: 550 × 31
#>    ID    SEX   MED1  MED2   DOSE   AMT    SS    II  TIME   TAD IPRED   CWRES
#>    <fct> <fct> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl>
#>  1 110   1     0     1       200   100     0     0   0     0   0      0     
#>  2 110   1     0     1       200     0     0     0   1     1   0.214 -2.83  
#>  3 110   1     0     1       200     0     0     0   1.5   1.5 0.296 -1.62  
#>  4 110   1     0     1       200     0     0     0   2     2   0.349  1.10  
#>  5 110   1     0     1       200     0     0     0   4     4   0.392  0.585 
#>  6 110   1     0     1       200     0     0     0   6     6   0.329 -0.0262
#>  7 110   1     0     1       200     0     0     0   8     8   0.249  0.0940
#>  8 112   1     1     1       200   100     0     0   0     0   0      0     
#>  9 112   1     1     1       200     0     0     0   0.5   0.5 0.556  0.0341
#> 10 112   1     1     1       200     0     0     0   1     1   0.712 -0.417 
#> # ℹ 540 more rows
#> # ℹ 19 more variables: CPRED <dbl>, IWRES <dbl>, EVID <dbl>, A1 <dbl>,
#> #   A2 <dbl>, DV <dbl>, PRED <dbl>, RES <dbl>, WRES <dbl>, CLCR <dbl>,
#> #   AGE <dbl>, WT <dbl>, KA <dbl>, CL <dbl>, V <dbl>, ALAG1 <dbl>, ETA1 <dbl>,
#> #   ETA2 <dbl>, ETA3 <dbl>

# Tip to list available tables in the xpdb
print(xpdb_ex_pk)
#> run001.lst overview: 
#>  - Software: nonmem 7.3.0 
#>  - Attached files (memory usage 1.5 Mb): 
#>    + obs tabs: $prob no.1: catab001.csv, cotab001, patab001, sdtab001 
#>    + sim tabs: $prob no.2: simtab001.zip 
#>    + output files: run001.cor, run001.cov, run001.ext, run001.grd, run001.phi, run001.shk 
#>    + special: <none> 
#>  - gg_theme: theme_readable 
#>  - xp_theme: theme_xp_default 
#>  - Options: dir = data, quiet = FALSE, manual_import = NULL