[Stable]

Mostly a back end function used by other functions.

insert_dollar(m, dollar, text, after_dollar)

Arguments

m

An nm object.

dollar

Character. Name of subroutine to insert.

text

Character vector. Text to fill.

after_dollar

Character name of preceding subroutine. The new subroutine will be inserted immediately after it.

Value

An nm object with modified ctl_contents field.

Examples


# create example object m1 from package demo files
exdir <- system.file("extdata", "examples", "theopp", package = "NMproject")
m1 <- new_nm(run_id = "m1", 
             based_on = file.path(exdir, "Models", "ADVAN2.mod"),
             data_path = file.path(exdir, "SourceData", "THEOPP.csv"))

m1 <- m1 %>% insert_dollar("MODEL", "
$MODEL
COMP = (CENTRAL)
", after_dollar = "SUB")

m1 %>% dollar("MODEL")
#> $`execute.Models/m1`
#>   1| 
#>   2| $MODEL
#>   3| COMP = (CENTRAL)
#>