Learn R Programming

editrules (version 2.2-0)

blocks: Decompose matrix or edits in independent blocks

Description

For matrices, a list of matrices is returned which direct sum to the original matrix. For objects of class editmatrix, editarray or editset, lists of corresponding objects not sharing any variable are returned.

Usage

blocks(M, ...)

Arguments

Value

list of independent subobjects of M.

Examples

Run this code
# three seperate blocks, will they be found?
E <- editmatrix( c( "x1 + x2 == x3"
                  , "x3 + x4 == x5"
                  , "x5 + x6 == x7"
                  , "y1 + y2 == y3"
                  , "z1 + z2 == z3")
               )
blocks(E)

# four seperate blocks, will they be found?
E <- editmatrix( c( "x1 + x2 == x3"
                  , "x3 + x4 == x5"
                  , "x8 + x6 == x7"
                  , "y1 + y2 == y3"
                  , "z1 + z2 == z3")
               )
blocks(E)

# two categorical blocks, will they be found?
E <- editarray(c(
 "x \%in\% c('a','b','c')",
 "y \%in\% c('d','e')",
 "z \%in\% c('f','g')",
 "u \%in\% c('w','t')",
 "if ( x == 'a') y != 'd'",
 "if ( z == 'f') u != 'w'")
)
blocks(E)

Run the code above in your browser using DataLab