HH (version 2.3-23)

t.trellis: Interchange the x- and y-axes for an S-Plus trellis object. Interchange the conditioning variables for an R trellis object.

Description

In S-Plus, change the "trellis" object to effectively, and after-the-fact convert formulas from (y ~ x | g) to (x ~ y | g). This is needed in S-Plus because most S-Plus trellis functions do not permit factors on the right-hand side of the formula. In R lattice functions, factors are permitted on the right-hand side of the formula. Therefore, to change the x and y axes within each panel, change the formula from (y ~ x | g) to (x ~ y | g). The HH t.trellis function in R calls lattice::t.trellis to interchange the conditioning variables for an R trellis object. See update.trellis.

Usage

## S3 method for class 'trellis':
t(x)

Arguments

x
any "trellis" object.

Value

  • In S-Plus, a "trellis" object with all x and y components interchanged. In R, the argument "trellis" object is sent to lattice::t.trellis to interchange the conditioning variables.

Details

In S-Plus, a warning is generated if the panel component of the "trellis" object is a function. No warning is generated when the panel component of the "trellis" object is a character string naming the function. We interchange the x and y values of the c("x", "y", "xlab", "ylab", "xlim", "ylim", "adj.xlim", "adj.ylim") components of the "trellis" object, and are aware of special features of the panel functions listed in the S-Plus version of t.trellis. The transpose will usually work correctly for other panel functions.

References

Heiberger, Richard~M. and Holland, Burt (2004b). Statistical Analysis and Data Display: An Intermediate Course with Examples in S-Plus, R, and SAS. Springer Texts in Statistics. Springer. ISBN 0-387-40270-5.

See Also

#ifndef S-Plus update.trellis #endif #ifdef S-Plus xyplot #endif

Examples

Run this code
tmp <- data.frame(y=rnorm(30), x=factor(rep(1:3,10)))
if.R(r=
     bwplot(y ~ x, data=tmp)
     ,s=
     t(bwplot(x ~ y, data=tmp))
     )

Run the code above in your browser using DataCamp Workspace