This family of functions implements the class nmctl: an object model of the NONMEM control stream. nmctl models a control stream as a list of records; each record is a character vector. The read and write functions (not generic) convert nmctl to and from file format. The print, format, and as.character methods display nmctl as it normally looks in a text editor. as.list.nmctl simply unclasses its argument. as.nmctl.character does the heavy work, breaking up a character vector into records and storing as a list. If parse is TRUE, as.nmctl attempts to convert certain records to higher-level objects.

as.nmctl(x, ...)

# S3 method for class 'nmctl'
as.character(x, ...)

# S3 method for class 'nmctl'
as.list(x, ...)

# S3 method for class 'character'
as.nmctl(
  x,
  pattern = "^ *\\$([^ ]+)( .*)?$",
  head = "\\1",
  tail = "\\2",
  parse = FALSE,
  ...
)

# S3 method for class 'nmctl'
format(x, ...)

# S3 method for class 'nmctl'
print(x, ...)

read.nmctl(con, parse = FALSE, ...)

write.nmctl(x, file = "data", ncolumns = 1, append = FALSE, sep = " ", ...)

Arguments

x

an nmctl object (or analogous character vector)

...

extra arguments passed to other functions

pattern

regular expression for first line of a control record

head

regular expression (relative to pattern) giving the name of the control record

tail

regular expression (relative to pattern) giving the balance of the control record

parse

whether to create R objects from the character vectors serving as records

con

a connection or the name of a file to open

file

passed to write

ncolumns

passed to write

append

passed to write

sep

passed to write

Details

Serendipitously, the record indicator in NONMEM control stream syntax is the same as the element selector in R list syntax: $. The convention is that names of elements in nmctl (lower case) are converted to record types (upper case) in the control stream. The user is free to add, delete, rearrange, and edit records using standard list manipulation techniques. When printed, records appear in list order. The write function warns if the 80 character limit is exceeded (not including comments).

Author

Tim Bergsma