insert_replacement_node {apsimx}R 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,
  rep.node.position = 1,
  new.core.position = rep.node.position + 1,
  edit.tag = "-edited",
  overwrite = FALSE,
  verbose = TRUE,
  root
)

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

rep.node.position

position where the replacement node will be inserted, default is 1

new.core.position

this by default will place the core simulation below the replacement node position. With this option, this can be modified.

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

root

supply the node postion in the case of multiple simulations such as factorials.

Value

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

Examples

## Not run: 
tmp.dir <- tempdir()
wheat <- get_apsimx_json(model = "Wheat", wrt.dir = tmp.dir)
extd.dir <- system.file("extdata", package = "apsimx")
insert_replacement_node("Wheat.apsimx", 
                        src.dir = extd.dir, wrt.dir = tmp.dir,
                        rep.node = wheat)

## End(Not run)


[Package apsimx version 2.6.2 Index]