HH (version 3.1-5)

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

Description

Convert a two-dimensional trellis object into a one-dimensional trellis object. It is mostly used as a utility by matrix.trellis.

Usage

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

Arguments

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

Value

  • trellis object with length(dim(x)) == 1

Examples

Run this code
tmp <- data.frame(a=factor(1:3),
                  b=c(4,5,7),
                  c=factor(5:7),
                  d=c(8, 9, 12),
                  e=factor(9:11))
tmp
a6 <- xyplot(b ~ d | a*e, data=tmp)
a6
dim(a6)
a62 <- as.vector(a6)
a62
dim(a62)

Run the code above in your browser using DataCamp Workspace