This function generates a modified SWAP file, changing the value
of the
passed variable
. Standard behavior is to pass an input_file
and an
output_file
. The input file will be parsed by parse_swap_file()
, the value
will be changed, and then a output_file
will be written to project_path
.
However, the function has a variety of different modes, see Details
modify_swap_file(
project_path,
input_file = NULL,
output_file = NULL,
variable,
value,
row = NULL,
fast = F,
write = T,
verbose = F
)
path to project directory string
SWAP file name to modify (required if fast=FALSE) string
SWAP file name write (required if write=TRUE) string
SWAP variable to change string
value to assign string
(optional) only pass if vector (as index) or table. integer
(optional) If rswap has already parsed the swap file flag
(optional) Flag to enable or disable writing of output file flag
(optional) print status? flag
Returns the path to written output file
This function has a variety of modes. If you would like to run the function
quickly, you can enable fast
which does NOT parse the input_file
.
This only works if you have already parsed the desired data, and it is
present in your rswap
directory.
Another way to speed up this function is to disable write
. this simply does
not write your output_file
Caution: Not passing an output_file
with write=TRUE
will cause your
input_file
to be overwritten!
Note: If you are changing a variable located in a SWAP vector or table, you
need to pass the row
argument (which is an index for vectors, and a normal
row for tables)