Skip to contents

Creates an xpose.data object.

Usage

xpose.data(
  runno,
  tab.suffix = "",
  sim.suffix = "sim",
  cwres.suffix = "",
  directory = ".",
  quiet = TRUE,
  table.names = c("sdtab", "mutab", "patab", "catab", "cotab", "mytab", "extra", "xptab",
    "cwtab"),
  cwres.name = c("cwtab"),
  mod.prefix = "run",
  mod.suffix = ".mod",
  phi.suffix = ".phi",
  phi.file = NULL,
  nm7 = NULL,
  ...
)

Arguments

runno

Run number of the table files to read.

tab.suffix

Suffix to be appended to the table file names for the "real" data.

sim.suffix

Suffix to be appended to the table file names for any simulated data.

cwres.suffix

Suffix to be appended to the table file names for any CWRES data.

directory

Where the files are located.

quiet

A logical value indicating if more diagnostic messages should be printed when running this function.

table.names

Default text that Xpose looks for when searching for table files.

cwres.name

default text that xpose looks for when searching for CWRES table files.

mod.prefix

Start of model file name.

mod.suffix

End of model file name.

phi.suffix

End of .phi file name.

phi.file

The name of the .phi file. If not NULL then supersedes paste(mod.prefix,runno,phi.suffix,sep="").

nm7

T/F if table files are for NONMEM 7/6, NULL for undefined.

...

Extra arguments passed to function.

Value

An xpose.data object. Default values for this object are created from a file called 'xpose.ini'. This file can be found in the root directory of the 'xpose4' package:

system.file("xpose.ini",package="xpose4").

It can be modified to fit the users wants and placed in the home folder of the user or the working directory, to override default settings.

Details

Xpose expects, by default, to find at least one the the following NONMEM tables in the working directory to be able to create an Xpose data object (using a run number of '5' as an example):

sdtab5: The 'standard' parameters, including IWRE, IPRE, TIME, and the NONMEM default items (DV, PRED, RES and WRES) that are added when NOAPPEND is not present in the $TABLE record.

$TABLE ID TIME IPRE IWRE NOPRINT ONEHEADER FILE=sdtab5

patab5: The empirical Bayes estimates of individual model parameter values, or posthoc estimates. These are model parameters, such as CL, V2, ETA1, etc.

$TABLE ID CL V2 KA K F1 ETA1 ETA2 ETA3 NOPRINT NOAPPEND ONEHEADER FILE=patab5

catab5: Categorical covariates, e.g. SEX, RACE.

$TABLE ID SEX HIV GRP NOPRINT NOAPPEND ONEHEADER FILE=catab5

cotab5: Continuous covariates, e.g. WT, AGE.

$TABLE ID WT AGE BSA HT GGT HB NOPRINT NOAPPEND ONEHEADER FILE=cotab5

mutab5, mytab5, extra5, xptab5: Additional variables of any kind. These might be useful if there are more covariates than can be accommodated in the covariates tables, for example, or if you have other variables that should be added, e.g. CMAX, AUC.

The default names for table files can be changed by changing the default values to the function. The files that Xpose looks for by default are:

paste(table.names, runno, tab.suffix, sep="")

The default CWRES table file name is called:

paste(cwres.name,runno,cwres.suffix,tab.suffix,sep="")

If there are simulation files present then Xpose looks for the files to be named:

paste(table.names, runno, sim.suffix, tab.suffix, sep="") paste(cwres.name,runno,sim.suffix,cwres.suffix,tab.suffix,sep="")

This is basically a wrapper function for the read.nm.tables, Data and SData functions. See them for further information.

Also reads in the .phi file associated with the run (Individual OFVs, parameters, and variances of those parameters.)

Author

Niclas Jonsson, Andrew Hooker

Examples

# Here we create files from an example NONMEM run
 
od = setwd(tempdir()) # move to a temp directory
(cur.files <- dir()) # current files in temp directory
#> [1] "bslib-f00e6fae00d8efe8984ec802f708f91a"
#> [2] "downlit"                               
#> [3] "file17a715324417"                      

simprazExample(overwrite=TRUE) # write files
(new.files <- dir()[!(dir() %in% cur.files)])  # what files are new here?
#> [1] "run1.ext"    "run1.lst"    "run1.mod"    "simpraz.dta" "xptab1"     

xpdb <- xpose.data(1)
#> 
#> Looking for NONMEM table files.
#>     Reading ./xptab1 
#> Table files read.
#> 
#> Looking for NONMEM simulation table files.
#> No simulated table files read.
#> 


file.remove(new.files) # remove these files
#> [1] TRUE TRUE TRUE TRUE TRUE
setwd(od)  # restore working directory


if (FALSE) {

# We expect to find the required NONMEM run and table files for run
# 5 in the current working directory, and that the table files have
# a suffix of '.dat', e.g. sdtab5.dat
xpdb5 <- xpose.data(5, tab.suffix = ".dat") 
}