[R] error in file(file, "r"): all connections are in use

Vadim Ogranovich vograno at evafunds.com
Tue May 4 23:49:17 CEST 2004


If you open a connection within a function it is often a good idea to
set an "on.exit" expression that will close the connection. This will be
called even if your function terminates via stop(). Here is an example:

 con <- file("foo")
 open(con)
 on.exit(close(con), add=TRUE)

HTH,
Vadim

> -----Original Message-----
> From: Lei Jiang [mailto:lj22 at u.washington.edu] 
> Sent: Tuesday, May 04, 2004 2:02 PM
> To: R-help at stat.math.ethz.ch
> Subject: [R] error in file(file, "r"): all connections are in use
> 
> 
> Hi, there.
> 
> I am trying to read multiple files into R, but I got following message
> 
> Error in file(file, "r"): All connections are in use.
> 
> I clean up memory everytime I read in one file. Do i have to 
> somehow release file connection everytime i read in one??
> 
> Thanks.
> 
> Lei
> 
> Department of Chemsitry
> University of Washington
> Box 351700
> Seattle, WA 98195
> Phone: 206-616-6882
> Fax: 206-685-8665
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> PLEASE 
> do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list