1_subsetting_operators: Subsetting Operators In vectools: Supplementary Vector-Related Tools

Description

Subsetting operators for vector-like objects.

Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```## S3 method for class 'ObjectArray' x[[...]] ## S3 replacement method for class 'ObjectArray' x[[...]] <- value ## S3 method for class 'NestMatrix' x[[i, j]] ## S3 replacement method for class 'NestMatrix' x[[i, j]] <- value ## S3 method for class 'SectMatrix' x[...] ## S3 replacement method for class 'SectMatrix' x[...] <- value ## S3 method for class 'SectMatrix' x[[i, j]] ## S3 replacement method for class 'SectMatrix' x[[i, j]] <- value ```

Arguments

 `x` A vector-like object. `i, j, ...` The indices. `value` The value to assign. For SectMatrix, the dimensions of the value need to match the dimensions set by setmap.

Details

ObjectArray and NestMatrix, are similar to lists, so:
Double bracket subsetting gets or sets a single element.

For SectMatrix (including PartMatrix):
Single bracket subsetting indexes submatrices and double bracket subsetting indexes the combined matrix.

Note that this may be changed in the future.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```s = matrix (1:16, 4, 4) #2x2 nested matrix, with 4 2x2 submatrices x = as.NestMatrix (s, 2, 2) x x [[1, 1]] #2x2 matrix x [[1, 1]][2, 2] #6 #4x4 nested matrix, with 16 scalar values x = as.NestMatrix.2 (s) x x [[2, 2]] #6 #4x4 partitioned matrix, partitioned into 4 2x2 submatrices x = as.PartMatrix (s, 2, 2) x x [1, 1] #2x2 matrix x [[2, 2]] #6 x [1, 1][2, 2] #6 ```

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