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
Usage
modify_swap_file(
project_path,
input_file = NULL,
output_file = NULL,
variable,
value,
row = NULL,
fast = F,
write = T,
verbose = F
)Arguments
- project_path
path to project directory
string- input_file
SWAP file name to modify (required if fast=FALSE)
string- output_file
SWAP file name write (required if write=TRUE)
string- variable
SWAP variable to change
string- value
value to assign
string- row
(optional) only pass if vector (as index) or table.
integer- fast
(optional) If rswap has already parsed the swap file
flag- write
(optional) Flag to enable or disable writing of output file
flag- verbose
(optional) print status?
flag
Details
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)
