Read in table file with multiple NONMEM tables.

nm_file_multi_tab(.path, add_table_names = TRUE, table_pattern = "TABLE NO")

Arguments

.path

a path to a table file.

add_table_names

Logical (T/F). If TRUE, include a column denoting the table names as specified in the file (e.g., 'TABLE NO. 1').

table_pattern

character string defining the start of a new table (regex accepted).

Value

either a tibble or list depending on the column names of each table

Details

The returned object will change depending on the types of tables contained in the file:

  • If each table is the same number of rows and column names (e.g., simulation data), the file can be read-in all at once (significant performance improvements), and the data will be coerced to a single dataframe.

  • If the number of rows differ across any of the tables, they must be read in one at a time.

  • If the column names differ across any of the tables, a list of tables is returned.

If a single dataframe can be returned, an additional nn column will be appended denoting the table number. This would also be the simulation number if running a simulation (removing the need to keep track of iterations within the control stream itself).

This function expects that tables are in the following format by default (column names can differ as noted above):

TABLE NO.  1
NUM         ID          DV
1.0000E+00  1.0000E+00  5.45615E+00
TABLE NO.  2
NUM         ID          DV
1.0000E+00  1.0000E+00  6.54565E+00