Learn R Programming

NMproject (version 0.6.9)

gsub_ctl: 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_)

Value

An nm object with modified ctl_contents field.

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.

See Also

apply_manual_edit()

Examples

Run this code


# 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")

Run the code above in your browser using DataLab