R: Convert a two-dimensional trellis object into a...
as.vector.trellis
R 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.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HH)
Loading required package: lattice
Loading required package: grid
Loading required package: latticeExtra
Loading required package: RColorBrewer
Loading required package: multcomp
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS
Attaching package: 'TH.data'
The following object is masked from 'package:MASS':
geyser
Loading required package: gridExtra
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HH/as.vector.trellis.Rd_%03d_medium.png", width=480, height=480)
> ### Name: as.vector.trellis
> ### Title: Convert a two-dimensional trellis object into a one-dimensional
> ### trellis object. Change the order of panels in a trellis object.
> ### Aliases: as.vector.trellis reorder.trellis
> ### Keywords: dplot
>
> ### ** 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
a b d e
1 a 1 1 D
2 b 2 2 D
3 c 3 3 D
4 a 4 4 E
5 b 5 5 E
6 c 6 6 E
7 a 7 7 F
8 b 8 8 F
9 c 9 9 F
> a6 <- xyplot(b ~ d | a*e, data=tmp, pch=19)
> a6
> dim(a6)
[1] 3 3
> a62 <- as.vector(a6)
> a62
> dim(a62)
[1] 9
> a63 <- reorder(a6, c(1,4,7, 2,5,8, 3,6,9))
> a63
> dim(a63)
[1] 9
> a64 <- matrix.trellis(a63, nrow=3, ncol=3, dimnames=dimnames(a6), byrow=TRUE)
> a64
> dim(a64)
[1] 3 3
>
>
>
>
>
> dev.off()
null device
1
>