Access model output file data from an xpdb object.

get_file(
  xpdb,
  file = NULL,
  ext = NULL,
  .problem = NULL,
  .subprob = NULL,
  .method = NULL,
  quiet
)

Arguments

xpdb

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

file

Full name of the file to be extracted from the xpdb e.g. 'run001.phi'. Alternative to the 'ext' argument.

ext

Extension of the file to be extracted from the xpdb e.g. 'phi'. Alternative to the 'file' argument.

.problem

The problem to be used, by default returns the last one for each file.

.subprob

The subproblem to be used, by default returns the last one for each file.

.method

The estimation method to be used (e.g. 'foce', 'imp', 'saem'), by default returns the last one for each file.

quiet

Logical, if FALSE messages are printed to the console.

Value

A tibble for single file or a named list for multiple files.

Examples

# Single file (returns a tibble)
ext_file <- get_file(xpdb_ex_pk, file = 'run001.ext')
#> Returning data from run001.ext, $prob no.1, subprob no.1, method foce
ext_file
#> # A tibble: 28 × 16
#>    ITERATION THETA1 THETA2 THETA3 THETA4 THETA5  THETA6  THETA7 `SIGMA(1,1)`
#>        <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>   <dbl>   <dbl>        <dbl>
#>  1         0   25.4   1.47   7.45  0.214  0.200 0.00983 0.00601            1
#>  2         1   26.3   1.26   7.35  0.219  0.217 0.00989 0.00602            1
#>  3         2   25.6   1.47   7.29  0.216  0.212 0.00987 0.00603            1
#>  4         3   26.8   1.49   5.76  0.213  0.213 0.00979 0.00628            1
#>  5         4   26.7   1.49   5.69  0.213  0.212 0.00979 0.00629            1
#>  6         5   26.7   1.49   5.66  0.213  0.212 0.00979 0.00630            1
#>  7         6   26.6   1.49   5.03  0.210  0.217 0.0100  0.00652            1
#>  8         7   26.6   1.49   4.93  0.205  0.217 0.0100  0.00658            1
#>  9         8   26.6   1.48   4.62  0.211  0.217 0.00951 0.00735            1
#> 10         9   26.6   1.46   4.41  0.209  0.217 0.00903 0.00874            1
#> # ℹ 18 more rows
#> # ℹ 7 more variables: `OMEGA(1,1)` <dbl>, `OMEGA(2,1)` <dbl>,
#> #   `OMEGA(2,2)` <dbl>, `OMEGA(3,1)` <dbl>, `OMEGA(3,2)` <dbl>,
#> #   `OMEGA(3,3)` <dbl>, OBJ <dbl>

# Multiple files (returns a list)
files <- get_file(xpdb_ex_pk, file = c('run001.ext', 'run001.phi'))
#> Returning data from run001.ext, run001.phi
files
#> $run001.ext_prob_1_subprob_1_foce
#> # A tibble: 28 × 16
#>    ITERATION THETA1 THETA2 THETA3 THETA4 THETA5  THETA6  THETA7 `SIGMA(1,1)`
#>        <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>   <dbl>   <dbl>        <dbl>
#>  1         0   25.4   1.47   7.45  0.214  0.200 0.00983 0.00601            1
#>  2         1   26.3   1.26   7.35  0.219  0.217 0.00989 0.00602            1
#>  3         2   25.6   1.47   7.29  0.216  0.212 0.00987 0.00603            1
#>  4         3   26.8   1.49   5.76  0.213  0.213 0.00979 0.00628            1
#>  5         4   26.7   1.49   5.69  0.213  0.212 0.00979 0.00629            1
#>  6         5   26.7   1.49   5.66  0.213  0.212 0.00979 0.00630            1
#>  7         6   26.6   1.49   5.03  0.210  0.217 0.0100  0.00652            1
#>  8         7   26.6   1.49   4.93  0.205  0.217 0.0100  0.00658            1
#>  9         8   26.6   1.48   4.62  0.211  0.217 0.00951 0.00735            1
#> 10         9   26.6   1.46   4.41  0.209  0.217 0.00903 0.00874            1
#> # ℹ 18 more rows
#> # ℹ 7 more variables: `OMEGA(1,1)` <dbl>, `OMEGA(2,1)` <dbl>,
#> #   `OMEGA(2,2)` <dbl>, `OMEGA(3,1)` <dbl>, `OMEGA(3,2)` <dbl>,
#> #   `OMEGA(3,3)` <dbl>, OBJ <dbl>
#> 
#> $run001.phi_prob_1_subprob_1_foce
#> # A tibble: 74 × 12
#>    SUBJECT_NO    ID `ETA(1)` `ETA(2)` `ETA(3)` `ETC(1,1)` `ETC(2,1)` `ETC(2,2)`
#>         <dbl> <dbl>    <dbl>    <dbl>    <dbl>      <dbl>      <dbl>      <dbl>
#>  1          1   110  -0.0370 -0.00596  -2.14      0.0258  -0.00961       0.0339
#>  2          2   112  -0.0495  0.122    -0.0235    0.0140  -0.00219       0.0138
#>  3          3   113   0.332   0.0259   -1.15      0.00995  0.000300      0.0257
#>  4          4   121   0.304   0.249     1.89      0.00741  0.00362       0.0137
#>  5          5   123   0.0271 -0.0801    1.09      0.00794  0.00267       0.0135
#>  6          6   124   0.332   0.111    -1.54      0.0110  -0.00219       0.0307
#>  7          7   126   0.190  -0.0315    2.20      0.00785  0.00300       0.0136
#>  8          8   127   0.190  -0.0750    0.415     0.0112   0.00469       0.0153
#>  9          9   128  -0.0138 -0.00130  -1.27      0.0120   0.0000333     0.0287
#> 10         10   210  -0.307  -0.108    -0.0168    0.00988  0.00112       0.0163
#> # ℹ 64 more rows
#> # ℹ 4 more variables: `ETC(3,1)` <dbl>, `ETC(3,2)` <dbl>, `ETC(3,3)` <dbl>,
#> #   OBJ <dbl>
#> 

# Tip to list available files 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