pmx_read_nm_tables: NONMEM output table import function

Description Usage Arguments Table format requirement Examples

View source: R/pmx_read_nm_tables.R

Description

Quickly import NONMEM output tables into R. This function automatically detects the optimal settings to import the tables from nonmem. It is based on the read_nm_tables function of xpose. Slight adjustment were made for purposes of pmx_nm()

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pmx_read_nm_tables(
  file = NULL,
  dir = NULL,
  combined = TRUE,
  rm_duplicates = TRUE,
  quiet = FALSE,
  simtab = NULL,
  ziptab = TRUE,
  user_mode = TRUE,
  ...
)

Arguments

file

A character vector of path to the files or a nm_table_list object created with list_nm_tables.

dir

Location of the model files.

combined

Logical value indicating whether multiple tables should be combined into a single one. If the number of rows does not match an error will be returned.

rm_duplicates

Logical value indicating whether duplicated columns should be removed.

quiet

Logical, if FALSE messages are printed to the console.

simtab

If TRUE only reads in simulation tables, if FALSE only reads estimation tables. Default NULL reads all tables.

ziptab

If TRUE search for the tables that have been compressed and renamed ??<file>.zip'.

user_mode

Adjustment to the original code: usermode is set to "usermode = TRUE" in order to improve this function for purposes of pmx_nm() (nonmem_reader.R), In order to use this function seperatly, the use of the original function in the xpose package is advised.

...

Additional arguments to be passed to the read_table2 or read_csv functions.

Table format requirement

When using pmx_read_nm_tables with the combined argument set to FALSE an ID column must be present in all data tables. When combined is set to TRUE instead an ID column must be present in at least one table for each problem and for each 'firstonly' category. ID columns are required to properly combine/merge tables and removing NA records. If the ID column is missing from a table and combined = FALSE pmx_read_nm_tables will return the following warning: Unknown variables: `ID`. While the data is returned beware that NA records might be left in the data and the output should be checked carefully. If combined = TRUE pmx_read_nm_tables is more strict and will return the following warning instead: Dropped `<tablenames>` due to missing required `ID` column..

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 

# Adjustment to the original code: usermode is set to "usermode = TRUE" 
# in order to improve this function for purposes of pmx_nm() (nonmem_reader.R)
# In order to use this function seperatly, the use of the original function in 
# the xpose package is advised.

# Import tables manually and return them as a list of individual tables
nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), 
                            dir = 'models', combined = FALSE)

# Import tables manually and return them as a single merged table
nm_tables <- pmx_read_nm_tables(file = c('sdtab001', 'patab001'), 
                            dir = 'models', combined = TRUE)


## End(Not run)

ggPMX documentation built on Sept. 20, 2021, 5:09 p.m.