Learn R Programming

replacer (version 1.0.2)

bReplace: 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)

Value

A named list displaying updated data and multiple replacement count tables. Also, updated csv files which are saved to dir.

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.

See Also

replaceVals

Examples

Run this code

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)
 }

Run the code above in your browser using DataLab