[R] [FORGED] Extracting specified pages from a lattice ("trellis") object.

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Tue Apr 24 07:51:32 CEST 2018


On 24/04/18 15:17, Paul Murrell wrote:

> Hi
> 
> I think the subsetting works by giving you the panels for the 
> corresponding levels of the conditioning variable(s).  Note that, if 
> there is more than one conditioning variable, you will need more than 
> one subsetting index.
> 
> For example, taking this plot with two conditioning variables and 12 
> panels in total ...
> 
> dotplot(variety ~ yield | year * site, data=barley)
> 
> ... this produces three pages ...
> 
> dotplot(variety ~ yield | year * site, data=barley,
>          layout=c(2,2))
> 
> ... and this produces the second page (both panels for the first 
> conditioning variable and the third and fourth panels for the second 
> conditioning variable) ...
> 
> dotplot(variety ~ yield | year * site, data=barley,
>          layout=c(2,2))[1:2, 3:4]
> 
> Hope that helps.

Hmm.  Thanks Paul.  I may be able to work with that.  But what I really 
wanted was to take

     bar <- dotplot(variety ~ yield | year * site, data=barley)

and then do (something like)

     foo <- bar[<something>]

so that foo contains only the second page of bar, and then do print(foo)
to get a plot of (just) the second page.  Without re-issuing a 
(modified) plot command.

Is that not at all possible?

cheers,

Rolf.

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276




More information about the R-help mailing list