[R] lattice -- panel order display

Luis Ridao Cruz Luisr at frs.fo
Tue Mar 1 17:41:35 CET 2005


I do the following:

test$year <- factor (test$year , ordered = TRUE)
xyplot ( number~cm | year, data = test , type = "l" )

and still get the same.


Luis

>>> Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> 01/03/2005 16:04:34
>>>


Luis Ridao Cruz allegedly said on 3/1/2005 8:50 AM:
> R-help,
> 
> I'm using 'xyplot' in lattice package which plots length frecuencies
by
> year (10).
> The order I get is not logical and the 'index.cond' argument to
> 'xyplot' is a bit cumbersome when it comes to plot a great deal of
(in
> my case years).
> 
> I have tried sorting the conditioning variable but still get the
same
> result.
> 
> Is there any easy way to do it without making use of 'index.cond' ?
> 
> The function call is as follows:
> 
> xyplot ( number ~ cm | as.factor(test$year) , data=test)
> 
> 
> Thanks in advance
> 
> 
> 
>>version
> 
>          _              
> platform i386-pc-mingw32
> arch     i386           
> os       mingw32        
> system   i386, mingw32  
> status                  
> major    2              
> minor    0.1            
> year     2004           
> month    11             
> day      15             
> language R
> 


Luis,

You should set test$year as ?ordered:

# set `levels' to the order you want the panels to appear
test$year <- ordered(test$year, levels = .......)
xyplot ( number ~ cm | year , data = test)

--sundar




More information about the R-help mailing list