Learn R Programming

vectools (version 0.3.0)

20_ObjectArray: Object Arrays

Description

One, two and higher-dimensional object arrays.

NOTE: INTERNAL STRUCTURE OF OBJECTS IS SUBJECT TO CHANGE. DO NOT USE SLOTS, DIRECTLY.

Usage

ObjectArray (n, …, CLASS="", names, default.value=NULL)

as.ObjectArray (v, …, n, CLASS="", names)

Arguments

CLASS

A character vector of classes. Every object in the object array, needs to be of these classes. Note that the order is not important. The default, "<OBJECT>", means that objects can be of any class.

n

Positive integer vector, the dimensions.

names

List of character vectors, of names in each dimension, which should match n, above. May be NULL or contain NULL values.

default.value

Default value, for each element.

v

In as.ObjectArray, a list. In as.NestMatrix, a matrix or a PartMatrix.

Ignored.

Value

An ObjectArray object.

Details

ObjectArray(s) are similar to list matrices and list arrays. (But these are S4 classes, with a number of differences).

Setting individual elements to NULL, doesn't remove them. And they support formatting, via objtag methods.

By default, an ObjectArray can contain any objects, however, this can be restricted by the CLASS argument.

See Also

Subclasses: ImageArray GeomArray NestMatrix MatrixArray

PartMatrix, SectMatrix Similar to NestMatrix.

Subsetting Operators

Standard Methods

Binary Operators Operations on MatrixArray objects.

Examples

Run this code
# NOT RUN {
v <- ObjectArray (c (2, 2), CLASS="list")
v [[1, 1]] <- list (1)
v [[2, 1]] <- list (1, 2)
v [[1, 2]] <- list (1, 2, 3)
v [[2, 2]] <- list (1, 2, 3, 4)
v

v [[1, 2]]
# }

Run the code above in your browser using DataLab