NMscanTables: Find and read all output data tables in Nonmem run

View source: R/NMscanTables.R

NMscanTablesR Documentation

Find and read all output data tables in Nonmem run

Description

Find and read all output data tables in Nonmem run

Usage

NMscanTables(
  file,
  as.fun,
  quiet,
  col.nmrep = TRUE,
  col.tableno = FALSE,
  col.id = "ID",
  col.row,
  details,
  skip.absent = FALSE,
  meta.only = FALSE
)

Arguments

file

the Nonmem file to read (normally .mod or .lst)

as.fun

The default is to return data as a data.frame. Pass a function (say tibble::as_tibble) in as.fun to convert to something else. If data.tables are wanted, use as.fun="data.table". The default can be configured using NMdataConf.

quiet

The default is to give some information along the way on what data is found. But consider setting this to TRUE for non-interactive use. Default can be configured using NMdataConf.

col.nmrep

col.nmrep If tables are repeated, include a counter? It does not relate to the order of the $TABLE statements but to cases where a $TABLE statement is run repeatedly. E.g., in combination with the SUBPROBLEMS feature in Nonmem, it is useful to keep track of the table (repetition) number. If col.nmrep is TRUE, this will be carried forward and added as a column called NMREP. This is default behavior when more than one $TABLE repetition is found in data. Set it to a different string to request the column with a different name. The argument is passed to NMscanTables.

col.tableno

Nonmem includes a counter of tables in the written data files. These are often not useful. However, if col.tableno is TRUE (not default), this will be carried forward and added as a column called NMREP. Even if NMREP is generated by NMscanTables, it is treated like any other table column in meta (?NMinfo) data.

col.id

name of the subject ID column. Used for calculation of the number of subjects in each table.

col.row

The name of the row counter column. Optional and only used to check whether the row counter is in the data.

details

If TRUE, metadata is added to output. In this case, you get a list. Typically, this is mostly useful if programming up functions which behavior must depend on properties of the output.

skip.absent

Skip missing output table files with a warning? Default is FALSE in which case an error is thrown.

meta.only

If TRUE, tables are not read, only a table is returned showing what tables were found and some available meta information. Notice, not all meta information (e.g., dimensions) are available because the tables need to be read to derive that.

Value

A list of all the tables as data.frames. If details=TRUE, this is in one element, called data, and meta is another element. If not, only the data is returned.

See Also

Other DataRead: NMreadCsv(), NMreadTab(), NMscanData(), NMscanInput()

Examples

tabs1 <- NMscanTables(system.file("examples/nonmem/xgxr001.lst", package="NMdata"))

NMdata documentation built on Nov. 11, 2023, 5:07 p.m.