bReplace {replacer} | R Documentation |
Batch-file value replacement
Description
User-intended function to process a list of pairs of data files and associated lookup files listed in this order.
Usage
bReplace(dir, x, save = TRUE, msgs = FALSE)
Arguments
dir |
Quoted character of length = 1 describing the path to the directory containing the data and associated lookup files, with either forward or double backward slash and no end slash (e.g. "C:/path/to/directory"). |
x |
List of character vectors each of length 2 containing full names of the data file and the associated lookup file, as described in replaceVals. |
save |
Logical, default TRUE: save results to directory; FALSE: display only. |
msgs |
Logical, default FALSE: suppress messages. TRUE: print a named list containing messages specific to each run. |
Value
A named list displaying updated data and multiple replacement count tables. Also, updated csv files which are saved to dir.
Note
In examples, please leave argument save to FALSE. Otherwise, copy all content of folder "extdata" found in the installed package root into a directory on your machine. Use the absolute path to this directory as dir argument.
See Also
Examples
if (interactive()) {
# A list of data/lookup names:
fs = list(c('data.csv', 'lookup.csv')
, c("data_unique.csv", "lookup_unique.csv")
, c('data_id.csv', 'lookupNA.csv')
, c('data_id.csv', 'lookupDUP.csv')
, c('chile.csv', 'chile_nadup.csv')
, c('data_id.csv', 'lookup_id.csv')
, c('data_id.csv', 'lookup_idsimple.csv')
, c('chile.csv', 'chile_id.csv')
)
##Not run:
dir = system.file("extdata", package = "replacer")
bReplace(dir, fs, save = FALSE, msgs = TRUE)
}