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.

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>.

Value

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

Details

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

Examples

spec <- ys_help$spec()
nm_input(spec)
#> $INPUT
#> C NUM ID SUBJ=DROP TIME SEQ CMT EVID AMT DV AGE WT CRCL ALB BMI
#> AAG SCR AST ALT HT CP TAFD TAD LDOS MDV BLQ PHASE STUDY RF=DROP
nm_input(spec, DOSE = AMT, .drop = "ALT,BMI")
#> $INPUT
#> C NUM ID SUBJ=DROP TIME SEQ CMT EVID DOSE=AMT DV AGE WT CRCL ALB
#> BMI=DROP AAG SCR AST ALT=DROP HT CP TAFD TAD LDOS MDV BLQ PHASE
#> STUDY RF=DROP
nm_input(spec, .long = TRUE)
#> $INPUT
#> C         ; comment character
#> NUM       ; record number
#> ID        ; subject identifier
#> SUBJ=DROP ; subject identifier
#> TIME      ; TIME
#> SEQ       ; SEQ
#> CMT       ; compartment number
#> EVID      ; event ID
#> AMT       ; dose amount
#> DV        ; dependent variable
#> AGE       ; age
#> WT        ; weight
#> CRCL      ; CRCL
#> ALB       ; albumin
#> BMI       ; BMI
#> AAG       ; alpha-1-acid glycoprotein
#> SCR       ; serum creatinine
#> AST       ; aspartate aminotransferase
#> ALT       ; alanine aminotransferase
#> HT        ; height
#> CP        ; Child-Pugh score
#> TAFD      ; time after first dose
#> TAD       ; time after dose
#> LDOS      ; last dose amount
#> MDV       ; MDV
#> BLQ       ; below limit of quantification
#> PHASE     ; study phase indicator
#> STUDY     ; study number
#> RF=DROP   ; renal function stage
nm_input(spec, .long = TRUE, .decodes = TRUE)
#> $INPUT
#> C         ; comment character
#> NUM       ; record number
#> ID        ; subject identifier
#> SUBJ=DROP ; subject identifier
#> TIME      ; TIME
#> SEQ       ; SEQ 
#>           ; [0 = observation, 1 = dose]
#> CMT       ; compartment number
#> EVID      ; event ID 
#>           ; [0 = observation, 1 = dose]
#> AMT       ; dose amount
#> DV        ; dependent variable
#> AGE       ; age
#> WT        ; weight
#> CRCL      ; CRCL
#> ALB       ; albumin
#> BMI       ; BMI
#> AAG       ; alpha-1-acid glycoprotein
#> SCR       ; serum creatinine
#> AST       ; aspartate aminotransferase
#> ALT       ; alanine aminotransferase
#> HT        ; height
#> CP        ; Child-Pugh score 
#>           ; [0 = normal, 1 = Pugh1, 2 = Pugh2, 3 = Pugh3]
#> TAFD      ; time after first dose
#> TAD       ; time after dose
#> LDOS      ; last dose amount
#> MDV       ; MDV 
#>           ; [0 = non-missing, 1 = missing]
#> BLQ       ; below limit of quantification 
#>           ; [0 = above QL, 1 = below QL]
#> PHASE     ; study phase indicator 
#>           ; [values: 1]
#> STUDY     ; study number 
#>           ; [1 = SAD, 2 = MAD, 3 = Renal, 4 = Hepatic]
#> RF=DROP   ; renal function stage