nm_input: Create NONMEM $INPUT block code from yspec object

View source: R/nm_input.R

nm_inputR Documentation

Create NONMEM $INPUT block code from yspec object

Description

Extract column names from the yspec object and format for inclusion in a NONMEM control stream, potentially renaming or dropping columns. The default output is in wide format, including only the column names as well as any rename or drop information. The long format puts each column on a different line and includes the short name and optionally column decode information. See examples.

Usage

nm_input(
  spec,
  .width = 65,
  .cat = TRUE,
  .long = FALSE,
  .drop = NULL,
  .decodes = FALSE,
  ...
)

Arguments

spec

a yspec object.

.width

passed to base::strwrap() to limit the output line length.

.cat

if TRUE, the text is sent to the console with cat().

.long

if TRUE, produce ⁠$INPUT⁠ in long, verbose format.

.drop

a character vector or comma-separated string of columns to drop in the ⁠$INPUT⁠ listing; columns with character type are automatically dropped, so there is no need to list them here.

.decodes

if TRUE, print value and decode information where available for discrete column data; this is only printed when .long = TRUE.

...

unquoted column rename pairs with format ⁠<new name> = <old name>⁠.

Details

Columns with character type are automatically dropped; there is no need to list these under the .drop argument.

Value

A character vector of text forming the ⁠$INPUT⁠ block (including the ⁠$INPUT⁠ part).

Examples

spec <- ys_help$spec()
nm_input(spec)
nm_input(spec, DOSE = AMT, .drop = "ALT,BMI")
nm_input(spec, .long = TRUE)
nm_input(spec, .long = TRUE, .decodes = TRUE)


metrumresearchgroup/yspec documentation built on Dec. 22, 2024, 1:37 a.m.