Transforms a list of R (in)equalities into an edit matrix
with coefficients (A) for each variable, and a
constant (b) and operator (ops) for each
edit rule. Each row in the resulting editmatrix represents an linear
(in) equality. Each column in the resulting editmatrix
represents a variable.
There are three forms of creating an editmatrix:
- a
charactervector with
(in)equalities written in R syntax - a
expressionvector with (in)equalities written in R
syntax - a
data.framewith three columns:- name = a
characterwith the name
of each rule - edit = a
characterwith
(in)equalities written in R syntax - description = a
characterdescribing the intention of the rule
Typically these rules are stored in a external csv file
(or database).
The third form is the prefered form, because it allows
the documentation of constraints. This may be very useful
when the incorrect observations are analyzed. The
function editrules creates/extracts the
third form, which can be used to store edit rules
externally or to recreate an editmatrix later on.
Functions as.character and
as.expression extract the first and second
form.
The matrix is created by retrieving the coefficients of
the variables in the equalities. i.e. x == y
results in c(x=1, y=-1) and x == y + w
results in c(x=1, y=-1, w=-1)
By default the editmatrix is created using the comparison
operators (==,<=,>=,<,>,>=,>) in the edits. If option
normalize=TRUE is used all edits are transformed
into an A == b, A < b or A