editset {editrules} | R Documentation |
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 |
|
env |
environment to parse categorical edits in (normally, users need not specify this) |
x |
an |
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 |
|
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.
Value
editset
: An object of class editset
as.data.frame
: a data.frame
with columns 'name' and 'edit'.
See Also
editrules.plotting
, violatedEdits
, localizeErrors
,
getVars
, disjunct
, eliminate
, substValue
,
isFeasible
, contains
, is.editset
Examples
# 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')