bReplace: Batch-file value replacement

Description Usage Arguments Value Note Examples

View source: R/bReplace.R

Description

User-intended function to process a list of pairs of data files and associated lookup files listed in this order.

Usage

1
bReplace(dir, x, save = TRUE, msgs = FALSE)

Arguments

dir

Quoted character of length = 1L describing the path to the directory containing the data and associated lookup file(s), with either forward or double backward slash and no end slash.

x

List of character vectors of length 2 each, 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 counted list of messages within each run.

Value

A multiple-run named list with updated data and multiple replacement count tables. Also, csv updated data files saved to dir.

Note

In examples, please leave the function argument save to FALSE. Otherwise, copy all content of the folder "extdata", found in package's root, into a directory on your machine. Use the absolute path to this directory as dir argument (vignette example).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)
 }

replacer documentation built on Sept. 5, 2021, 5:18 p.m.