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

  file = NULL,
  dir = NULL,
  combined = TRUE,
  rm_duplicates = TRUE,
  quiet = FALSE,
  simtab = NULL,
  ziptab = TRUE,



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


Location of the model files.


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.


Logical value indicating whether duplicated columns should be removed.


Logical, if FALSE messages are printed to the console.


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


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


Additional arguments to be passed to the read_table2 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..


if (FALSE) { # 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) }