
An editmatrix
is a numerical matrix and a set of comparison operators representing
a linear system of (in)equations.
editmatrix(editrules, normalize = TRUE)# S3 method for editmatrix
as.data.frame(x, ...)
# S3 method for editmatrix
as.character(x, ...)
# S3 method for editmatrix
as.expression(x, ...)
# S3 method for editmatrix
as.matrix(x, ...)
# S3 method for editmatrix
c(...)
# S3 method for editmatrix
str(object, ...)
# S3 method for editmatrix
summary(object, useBlocks = TRUE, ...)
editmatrix
: An object of class editmatrix
as.data.frame
a 3-column data.frame
with columns 'name' and 'edit'.
If the input editmatrix has a description
attribute a third column is returned.
as.matrix
: Augmented matrix
of editmatrix
. (See also getAb
).
A character
or expression
vecotr with (in)equalities written in R syntax.
Alternatively, a data.frame
with a column named edits
, see details.
logical
specifying if all edits should be transformed (see description)
editmatrix object
Arguments to pass to or from other methods
an R object
logical
Summarize each block?
The function editmatrix
generates an editmatrix from a character
vector, an expression
vector or a data.frame
with at least the column edit
. The function editfile
reads edits from a free-form textfile, function as.editmatrix
converts a matrix, a vector of
constants and a vector of operators to an editmatrix
By default, the editmatrix
is normalized, meaning that all comparison operators are converted
to one of <
, <=
, or ==
. Users may specify edits using any of the operators
<, <=, ==, >=, >
(see examples below). However it is highly recommended to let editmatrix
parse them into normal
form as all functions operating on editmatrices expect or convert it to normal form anyway.
editrules.plotting
, violatedEdits
, localizeErrors
,
normalize
, contains
, is.editmatrix
,
getA
, getAb
, getb
, getOps
getVars
,
eliminate
, substValue
, isFeasible
# Using a character vector to define contraints
E <- editmatrix(c("x+3*y==2*z", "x==z"))
print(E)
# Using a expression vector to define contraints
E <- editmatrix(expression(x+3*y==2*z, x==z))
print(E)
# an editmatrix also has a summary method:
summary(E)
# select rows from an editmatrix:
E <- editmatrix(c("x+3*y==2*z", "x >= z"))
E[getOps(E) == "=="]
#Using data.frame to define constraints
E.df <- data.frame(
name =c("A","B","C"),
edit = c("x == y",
"z + w == y + x",
"z == y + 2*w"),
description = c(
"these variables should be equal","","")
)
print(E.df)
E <- editmatrix(E.df)
print(E)
# Using a character vector to define contraints
E <- editmatrix(c("x+3*y==2*z", "x==z"))
print(E)
# Using a expression vector to define contraints
E <- editmatrix(expression(x+3*y==2*z, x==z))
print(E)
# an editmatrix also has a summary method:
summary(E)
# select rows from an editmatrix:
E <- editmatrix(c("x+3*y==2*z", "x >= z"))
E[getOps(E) == "=="]
#Using data.frame to define constraints
E.df <- data.frame(
name =c("A","B","C"),
edit = c("x == y",
"z + w == y + x",
"z == y + 2*w"),
description = c(
"these variables should be equal","","")
)
print(E.df)
E <- editmatrix(E.df)
print(E)
Run the code above in your browser using DataLab