Learn R Programming

vectools (version 0.3.0)

33_standard_methods: Standard Methods

Description

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

Usage

# S3 method for GeomObject
print(x, …)
# S3 method for MImage
print(x, …)
# S3 method for SImage
print(x, …)

# 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 VecLike 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 VecLike head(x, n=6, …) # S3 method for raster head(x, …) # S3 method for VecLike tail(x, n=6, …) # S3 method for raster tail(x, …)

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.

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.

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