NMreadSection: extract sections of Nonmem control streams

Description Usage Arguments Value Functions See Also Examples

View source: R/NMreadSection.R

Description

This is a very commonly used wrapper for the input part of the model file. Look NMextractText for more general functionality suitable for the results part too.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
NMreadSection(
  file = NULL,
  lines = NULL,
  text = NULL,
  section,
  return = "text",
  keepEmpty = FALSE,
  keepName = TRUE,
  keepComments = TRUE,
  asOne = TRUE,
  simplify = TRUE,
  cleanSpaces = FALSE,
  ...
)

NMgetSection(...)

Arguments

file

A file path to read from. Normally a .mod or .lst. See lines also.

lines

Text lines to process. This is an alternative to using the file argument.

text

Use this argument if the text to process is one long character string, and indicate the line seperator with the linesep argument (handled by NMextractText). Use only one of file, lines, and text.

section

The name of section to extract. Examples: "INPUT", "PK", "TABLE", etc.

return

If "text", plain text lines are returned. If "idx", matching line numbers are returned. "text" is default.

keepEmpty

Keep empty lines in output? Default is FALSE.

keepName

Keep the section name in output (say, "$PROBLEM") Default is TRUE. It can only be FALSE, if return"idx".

keepComments

Keep comment lines?

asOne

If multiple hits, concatenate into one. This will most often be relevant with name="TABLE". If FALSE, a list will be returned, each element representing a table. Default is TRUE. So if you want to process the tables separately, you probably want FALSE here.

simplify

If asOne=FALSE, do you want the result to be simplified if only one section is found? Default is TRUE which is desirable for interactive analysis. For programming, you probably want FALSE.

cleanSpaces

If TRUE, leading and trailing are removed, and multiplied succeeding white spaces are reduced to single white spaces.

...

Additional arguments passed to NMextractText

Value

character vector with extracted lines.

Functions

See Also

Other Nonmem: NMapplyFilters(), NMextractText(), NMwriteData(), NMwriteSection()

Examples

1
NMreadSection(system.file("examples/nonmem/xgxr001.lst", package="NMdata"),section="DATA")

NMdata documentation built on Aug. 10, 2021, 1:06 a.m.