MyNixOS website logo
Description

A Value Replacement Utility.

Updates values within csv format data files using a custom, User-built csv format lookup file. Based on 'data.table' package.

replacer

replacer, a value replacement utility currently based on package data.table, is intended for outside-database update of data. It requires the preparation of a lookup file which is a list of replacement requests with and, in special circumstances, without an index column.

This utility is accessible to beginners to R and facilitates complex dataset updates with minimal prompt time by employing User-friendly functions which automatically follow a decision tree rooted in User’s input.

Data processing such as data cleanup, file format conversion and the appendage of new data to data files are outside the scope.

Installation

You can install the released version of replacer from CRAN with:

install.packages("replacer")

Example

Below is a basic example which shows the screen result of data replacement using a lookup file without index:

require(replacer)
#> Loading required package: replacer
## basic example code
dir = system.file('extdata', package = 'replacer')
## update the 'data' dataset with new replacement values
replaceVals(dir, save = FALSE) 
#> 
#> reading data from: C:/R/R-4.1.2/library/replacer/extdata...
#> data reading complete ...
#> checking standard columns in lookup ...
#> starting replacements ...
#> found duplicates and simple replacements but no index in lookup :
#> 
#>  would recommend User-made index
#> proceeding any way ...
#> subsetting lookup and creating index ...
#> found request for 1:1 replacements: proceeding ...
#> completed 1:1 replacements ...
#> rejoining columns uninvolved in simple replacements ...
#> searching for 1:many replacements ...
#> found request for multiple duplicated value replacments: creating index ...
#> replacing multiple duplicated values ...
#> found request for multiple missing value replacements: replacing ...
#> processed 1:many replacements ...
#> there are still missing values in some involved columns!
#> 
#> helper function has completed!
#> $` updated_data_using_lookup`
#>                a       b       c    d
#>  1:           aa   7.174   0.259   11
#>  2: NOT  PRESENT  17.572   0.478 5555
#>  3:  DUP VALUE_1   8.888   0.707   NA
#>  4:           dd   0.794   0.737 5555
#>  5:           UU -13.964 999.000 5555
#>  6:  DUP VALUE_1   0.127   0.737    8
#>  7:           ff   8.836   0.476 5555
#>  8: NOT  PRESENT   6.397  -0.001    8
#>  9:           hh  -4.979   0.121    9
#> 10: NOT  PRESENT  -2.755  -0.227    8
#> 11:           EE   1.111  -0.127    6
#> 12: NOT  PRESENT   1.121   0.333    7
#> 13: NOT  PRESENT  -4.979   0.737 5555
#> 14: NOT  PRESENT 999.000   0.476 5555
#> 15: NOT  PRESENT   1.111 999.000    8
#> 16:           JJ   1.121 999.000 5555
#> 
#> $` multiple_dups_repl_counts`
#>    vars oldVals     newVals  a  b  d
#> 1:    a      cc DUP VALUE_1  2 NA NA
#> 2:    b   2.142       1.111 NA  2 NA
#> 3:    d      15        5555 NA NA  7
#> 
#> $` NAs_remaining`
#> a b c d 
#> 0 0 0 1

Familiarity with basic R commands is necessary. Familiarity with data.table is not, yet strongly recommended!

Users are encouraged to start by reading the vignette.

Metadata

Version

1.0.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows