as.vector.trellis: Convert a two-dimensional trellis object into a...

View source: R/matrix.trellis.r

as.vector.trellisR Documentation

Convert a two-dimensional trellis object into a one-dimensional trellis object. Change the order of panels in a trellis object.

Description

as.vector.trellis converts a two-dimensional trellis object into a one-dimensional trellis object. reorder.trellis changes the order of the panel.args component in a trellis object. These are are mostly used as utilities by matrix.trellis.

Usage

## S3 method for class 'trellis'
as.vector(x, mode = "any")
## S3 method for class 'trellis'
reorder(x, X, ...)

Arguments

x

trellis object.

mode

We are hijacking the mode argument. It is used here for the names of the panels.

...

Other arguments are ignored.

X

Subscript vector specifying the new order of the panels.

Value

trellis object with length(dim(x)) == 1. as.vector retains the original order of the panels. reorder changes the order to the one specified by using the X argument as a subscript.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

Examples

tmp <- data.frame(a=letters[c(1:3,1:3,1:3)],
                  b=1:9,
                  d=1:9,
                  e=LETTERS[c(4,4,4,5,5,5,6,6,6)])
tmp
a6 <- xyplot(b ~ d | a*e, data=tmp, pch=19)
a6
dim(a6)
a62 <- as.vector(a6)
a62
dim(a62)
a63 <- reorder(a6, c(1,4,7, 2,5,8, 3,6,9))
a63
dim(a63)
a64 <- matrix.trellis(a63, nrow=3, ncol=3, dimnames=dimnames(a6), byrow=TRUE)
a64
dim(a64)

HH documentation built on May 29, 2024, 6:24 a.m.

Related to as.vector.trellis in HH...