Learn R Programming

editrules (version 2.7.2)

editset: Read general edits

Description

An editset combines numerical (linear), categorical and conditional restrictions in a single object. Internally, it consists of two editmatrices and an editarray.

Usage

editset(editrules, env = new.env())

  ## S3 method for class 'editset':
as.character (x, datamodel = TRUE,
    useIf = TRUE, dummies = FALSE, ...)

  ## S3 method for class 'editset':
as.data.frame (x, ...)

  ## S3 method for class 'editset':
c (...)

  ## S3 method for class 'editset':
summary (object, useBlocks = TRUE, ...)

Arguments

editrules
character vector, expression vector or data.frame (see details) containing edits.
env
environment to parse categorical edits in (normally, users need not specify this)
datamodel
include datamodel?
useIf
return vectorized version?
dummies
return datamodel for dummy variables?
...
arguments to be passed to or from other methods
object
an R object
useBlocks
logical Summarize each block?

Value

  • editset: An object of class editset as.data.frame: a data.frame with columns 'name' and 'edit'.

Details

The function editset converts a character or expression vector to an editset. Alternatively, a data.frame with a column called edit can be supplied. Function editfile reads edits from a free-form textfile.

See Also

editrules.plotting, violatedEdits, localizeErrors, getVars, disjunct, eliminate, substValue, isFeasible, contains, is.editset

Examples

Run this code
# edits can be read from a vector of expressions 
E <- editset(expression(
    if ( x > 0 ) y > 0,
    x + y == z,
    A %in% letters[1:2],
    B %in% letters[2:3],
    if ( A == 'a') B == 'b',
    if ( A == 'b') x >= 0,
    u + v == w,
    if ( u >= 0 ) w >= 0
))
E
summary(E)
as.data.frame(E)
getVars(E)
getVars(E,type='cat')
getVars(E,type='num')


## see also editfile
E <- editfile(system.file('script/edits/mixedits.R',package='editrules'))
E
summary(E)
as.data.frame(E)
getVars(E)
getVars(E,type='cat')
getVars(E,type='num')




# edits can be read from a vector of expressions 
E <- editset(expression(
    if ( x > 0 ) y > 0,
    x + y == z,
    A %in% letters[1:2],
    B %in% letters[2:3],
    if ( A == 'a') B == 'b',
    if ( A == 'b') x >= 0,
    u + v == w,
    if ( u >= 0 ) w >= 0
))
E
summary(E)
as.data.frame(E)
getVars(E)
getVars(E,type='cat')
getVars(E,type='num')


## see also editfile
E <- editfile(system.file('script/edits/mixedits.R',package='editrules'))
E
summary(E)
as.data.frame(E)
getVars(E)
getVars(E,type='cat')
getVars(E,type='num')

Run the code above in your browser using DataLab