read_nm_tables {xpose}R Documentation

NONMEM output table import function

Description

Quickly import NONMEM output tables into R. This function automatically detects the optimal settings to import the tables from nonmem.

Usage

read_nm_tables(
  file = NULL,
  dir = NULL,
  combined = TRUE,
  rm_duplicates = TRUE,
  quiet = FALSE,
  simtab = NULL,
  ziptab = 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'.

...

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

Table format requirement

When using 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 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 read_nm_tables xpose is more strict and will return the following warning instead: Dropped `<tablenames>` due to missing required `ID` column..

Examples

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

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

# Import tables automatically (used internally by xpose_data())
nm_tables <- read_nm_model(file = 'run001.lst', dir = 'models') %>% 
              list_nm_tables() %>% 
              read_nm_tables()

# Passing arguments to readr via `...` 
# (e.g. import columns as character and only first 10 rows)
nm_tables <- read_nm_tables(file = 'sdtab001', dir = 'models', 
                            col_type = readr::cols(.default = 'c'), 
                            n_max = 10)


## End(Not run)

[Package xpose version 0.4.18 Index]