insert_replacement_node: Inserts a replacement node in a simple apsimx simulation file

View source: R/wget_apsimx_json.R

insert_replacement_nodeR Documentation

Inserts a replacement node in a simple apsimx simulation file

Description

Inserts a replacement node in a simple apsimx simulation file

Usage

insert_replacement_node(
  file,
  src.dir,
  wrt.dir,
  rep.node,
  edit.tag = "-edited",
  overwrite = FALSE,
  verbose = FALSE
)

Arguments

file

file ending in .apsimx to be edited (JSON)

src.dir

directory containing the .apsimx file to be edited; defaults to the current working directory

wrt.dir

should be used if the destination directory is different from the src.dir

rep.node

replacement node as obtained by the get_apsimx_json function

edit.tag

if the file is edited a different tag from the default ‘-edited’ can be used.

overwrite

logical; if TRUE the old file is overwritten, a new file is written otherwise

verbose

whether to print information about successful edit

Value

it does not return an R object but it writes an apsimx file to disk

Examples

## Not run: 
## It is not trivial to produce a reproducible example
## because the model and file versions need to align.
## The steps are:
## 1. Get model: 
##    wheat <- get_apsimx_json(model = "Wheat", wrt.dir = tmp.dir)
## 2. Create file that matches current model version
## 3. Edit the file by inserting the 'replacements' node
##    insert_replacement_node("Wheat.apsimx", rep.node = wheat)
                        

## End(Not run)


apsimx documentation built on Sept. 11, 2024, 5:42 p.m.