gsub_ctl: Pattern replacement for control file contents

View source: R/low-level-ctl-handling-funs.R

gsub_ctlR Documentation

Pattern replacement for control file contents

Description

[Stable]

A wrapper around gsub so that control files may be modified using gsub syntax. Can be useful for simple find replace operations in a control stream. Ensure you use the "view diff" app afterwards to make sure the find replace proceeded as intended.

Usage

gsub_ctl(m, pattern, replacement, ..., dollar = NA_character_)

Arguments

m

An nm object.

pattern

Argument passed to gsub().

replacement

Argument passed to gsub().

...

Additional arguments passed to gsub().

dollar

Character name of subroutine.

Value

An nm object with modified ctl_contents field.

See Also

apply_manual_edit()

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 %>% dollar("EST")

m1 <- m1 %>% gsub_ctl("ISAMPLE=300", "ISAMPLE=600")

m1 %>% dollar("EST")


NMproject documentation built on Sept. 30, 2022, 1:06 a.m.