[R] R console closes on its own

Duncan Murdoch murdoch at stats.uwo.ca
Tue Mar 4 18:21:05 CET 2008


On 2/20/2008 7:44 PM, Judith Flores wrote:
> Dear R-experts,
> 
>    I am running a script that has the following
> structure:
> 
> windows(height=5.5,width=8)
> 
> dat<-read.csv("myfile.csv")
> names(dat)<-c('a','b','c','d')
> dat<-dat[,1:4]
> 
> xyplot(dat$a~dat$b)
> 
> 
>    Then I usually save the plot as a PDF (from the
> menu in the R console). I can save the PDF twice in a
> row; but at the third time, right when I am about to
> give a name to the graph, R crashes, no error
> messages.
> 
>   I am using R 2.6.2, for Windows. I copy the script
> from TinnR.

I can reproduce a crash using the following code:

for (i in 1:100) {
windows()
plot(1:100)
}

When R opens too many graphics windows, it is running out of memory, but 
not failing gracefully.  It should be easy to fix.

The workaround in the short term is not to accumulate open graphics 
windows; close them when you're done.  This code runs without error:

for (i in 1:100) {
windows()
plot(1:100)
dev.off()
}

Duncan Murdoch



More information about the R-help mailing list