Learn R Programming

vectools (version 0.2.0)

20_standard_methods: Standard Methods

Description

Length, dim, print, format, head and tail methods for vector-like objects.

Usage

# S3 method for ObjectArray
length(x)
# S3 method for SectMatrix
length(x)

# S3 method for ObjectArray dim(x) # S3 method for SectMatrix dim(x)

# S3 method for ObjectArray dimnames(x) # S3 method for SectMatrix dimnames(x)

# S3 method for ObjectArray dimnames(x) <- value # S3 method for SectMatrix dimnames(x) <- value

# S3 method for VectorLike print(x, …)

# S3 method for ObjectArray format(x, …) # S3 method for SectMatrix format(x, na.string="", …) # S3 method for ZERO format(x, …)

# S3 method for VectorLike head(x, n=6, …) # S3 method for VectorLike tail(x, n=6, …)

Arguments

x

A suitable object

na.string

String, what to format NAs as.

n

Integer, the number of items.

value

A list of character vectors, matching the dimensions of the object.

Ignored.

Value

Most functions perform the same action as standard R functions.

The format methods return formatted character matrices.

Currently, some of the head, tail functions return formatted character matrices, however, it's possible this may change in the future.

Details

Note that the dimensions of object arrays and nested matrices are the dimensions of the top level object. However, the dimensions of sectioned matrices (including partitioned matrices) are the dimensions of the combined matrix.

You should also use any functions based on dim or dimnames such as nrow or rownames.

The format method for ObjectArray, calls the objtag function, for each of its elements.

The format method for sectioned and partitioned matrices, adds plain-text markup, for separators and section boxes.

See Also

ObjectArray

PartMatrix

Examples

Run this code
# NOT RUN {
x <- matrix (1:100, 10, 10)
pm <- as.PartMatrix (x, 5, c (2, 4, 6, 8) )
nm <- as.NestMatrix (pm)

dim (nm)
dim (pm)

head (nm, 2)
head (pm, 2)

nm
pm
# }

Run the code above in your browser using DataLab