correctionRules {deducorrect}R Documentation

Rules for deterministic correction

Description

Rules for deterministic correction

Usage

correctionRules(x, strict = TRUE, allowed = getOption("allowedSymbols"),
  ...)

## S3 method for class 'character'
correctionRules(x, strict = TRUE,
  allowed = getOption("allowedSymbols"), file = TRUE, ...)

## S3 method for class 'expression'
correctionRules(x, strict = TRUE,
  allowed = getOption("allowedSymbols"), ...)

## S3 method for class 'correctionRules'
print(x, ...)

## S3 method for class 'correctionRules'
as.character(x, oneliner = FALSE, ...)

## S3 method for class 'correctionRules'
getVars(E, ...)

Arguments

x

character or expression vector.

strict

If TRUE an error is thrown if any forbidden symbol is used (see details).

allowed

A character vector of allowed symbols

...

Currently unused.

file

If file=TRUE, x is treated as a filename from which the rules are read.

oneliner

Coerce to oneliner

E

object of class correctionRules

Value

correctionRules returns an object of class correctionRules

getVars returns a character vector of variable names.

Details

Data editing processes are rarely completely governed by in-record consistency rules. Many ad-hoc rules are commonly used to impute empty or erroneous values. Such rules are often applied manually or hidden in source code. This function, together with correctWithRules allows for easy definition and execution of simle deterministic replacement rules.

These functions are ment to support very simple rules, such as if variable x is missing, then set it to zero. Such actions usually basically model-free corrections stemming from subject-matter knowledge. Given the nature of such rules, the type of rules are by default limited to R-statements containing conditionals (if-else), arithmetic and logical operators, and brackets and assignment operators. see getOption('allowedSymbols') for a complete list.

If you cannot execute your 'simple' corrections with just these functions, we strongly recommend to write a separate imputation or correction routine. However, it's a free world, so you may alter the list of allowed symbols as you wish.

Note

getVars is overloaded from the editrules package.

See Also

correctWithRules


[Package deducorrect version 1.3.7 Index]