[R] Bug in plotting groupedData-objects

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jul 3 17:25:34 CEST 2003


Aren't these lattice plots that you have not print()-ed?  Auto-printing 
does not work except at top-level, and if(interactive() { ... } is not 
top-level.

Using print(plot(d)) works for me.


On Thu, 3 Jul 2003, Grathwohl,Dominik,LAUSANNE,NRC/BAS wrote:

> Dear Experts,
> 
> May be the problem is still solved, however I tried to find the answer in
> the archives:
> I use:
> > R.version
>          _              
> platform i386-pc-mingw32
> arch     i386           
> os       mingw32        
> system   i386, mingw32  
> status                  
> major    1              
> minor    7.1            
> year     2003           
> month    06             
> day      16             
> language R              
> 
> 
> # a small program to show you the problem:
> 
> library(NLME)

It's nlme, not NLME

> n <- 300
> 
> id <- gl(n, 3, 3*n)
> 
> visit <- rep(c(1:3), n)
> 
> y <- rnorm(3*n)
> 
> weight <- data.frame(cbind(id, visit, y))
> 
> d <- groupedData(y ~ visit|id, data=weight, 
> labels=list(visit="Week", y="DHA", id="ID"), 
> units=list(visit="(weeks)", y="(%)"), order.groups=F)
> 
> plot(d) # save by hand: 1.5 MB
> 
> if(interactive()) {
> 	win.metafile(filename="c:/tmp/mist.emf")
> 	plot(d)
> 	dev.off()
> }
> 
> # The file mist.emf is empty, however the plot command before works.
> 
> 
> if(interactive()) {
> 	win.metafile(filename="c:/tmp/mist2.emf")
> 	plot(visit,y)
> 	dev.off()
> }
> 
> # changing object, the file mist2.emf is not empty:
> 
> if(interactive()) {
> 	jpeg(filename="c:/tmp/mist.jpg", width=600, height=600,
> pointsize=12, quality=100, bg="white")
> 	plot(d)
> 	dev.off()
> }
> 
> # changing the driver, mist.jpg is empty!
> # So the problem seems to be some interaction with groupedData objects and
> graphic drivers.
> # Any hind is appreciated
> 
> # Regards,
> 
> # Dominik
> 
> Dominik Grathwohl 
> Biostatistician 
> Nestlé Research Center 
> PO Box 44, CH-1000 Lausanne 26 
> Phone: + 41 21 785 8034 
> Fax: + 41 21 785 8556 
> e-mail: dominik.grathwohl at rdls.nestle.com
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list