3_matrix_like_objects: Matrix-Like Objects

Description Usage Arguments Details Examples

Description

Nested, sectioned and partitioned matrices.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
NestMatrix (nr, nc, rnames, cnames, default.value=NA)
SectMatrix (nsect, nr, nc, rnames, cnames, default.value=NA)
PartMatrix (Rb, Cb, nr, nc, rnames, cnames, default.value=NA)

as.NestMatrix (x, Rb, Cb, rnames, cnames)
as.NestMatrix.2 (x, rnames, cnames)

as.SectMatrix (x, nsect, rnames, cnames)
as.PartMatrix (x, Rb, Cb, rnames, cnames)

setmap (x, ...) <- value
getmap (x, ...)

rnames (x)
cnames (x)
rnames (x, ...) <- value
cnames (x, ...) <- value

Arguments

nsect

The number (possibly in two or more dimensions) of submatrices.

Rb, Cb

The inter-row and inter-column indices.

nr, nc

The dimensions.

rnames, cnames

Character vectors giving the row and column names.

default.value

The default value of entries in the matrix.

value

For setmap, a two by two integer-valued matrix, or a length-4 vector, giving top-left row index, top-left column index, bottom-right row index and bottom-right column index. For the rnames/cnames functions, a character vector.

x

For the as functions, a standard matrix or data.frame. For the getmap/setmap functions, a SectMatrix object. For the rnames/cnames functions, any matrix-like object from above.

...

For getmap/setmap, the indices of the submatrix.

Details

Refer to the vignette for more information.

Examples

1
2
3
4
5
6
7
8
9
s = matrix (1:100, 10, 10)

x = as.SectMatrix (s, 2)
setmap (x, 1) = c (2, 2, 8, 8)
setmap (x, 2) = c (3, 3, 9, 9)
x

x = as.PartMatrix (s, 5, c (2, 4, 6, 8) )
x

vectools documentation built on Jan. 9, 2020, 5:09 p.m.