[R] how to close connections?

From: Ott Toomet <otoomet_at_ut.ee>
Date: Thu 25 Aug 2005 - 18:08:23 EST

Hi everybody,

I am using gzipped files quite extensively and cannot figure out how I can close (or reuse) connections.


> for(i in 1:300) {cat(i, "\n"); a <- readLines(gzfile("file.gz"), n=1) }
Error in gzfile("~/tyyq/andmebaasiq/ETU/ETU1997.tsv.gz") :

        all connections are in use

To use just gzfile without any open/close should be OK as the help states:

... In general functions using connections will open them if they are not open, but then close them again, so to leave a connection open call open explicitly.

I have also experimented with explicit open/close but without any more success, though, R claims that the connections will be closed.

Any ideas? Is it my misunderstanding? What exactly means a connection is "in use"?

Thanks in advance,


> version

platform i686-pc-linux-gnu

arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
major    2                
minor    1.1              
year     2005             
month    06               
day      20               
language R                

Ott Toomet, PhD
Research Fellow

Dept. of Economics
Tartu University
Narva 4 - A123
Tartu 51009

otoomet (a) ut ee
ph:  (+372) 7 37 6374
fax: (+372) 7 37 6312

 (o_         (*_         (O_         (o< -!  
//\         //\         //\         //\      
V_/_        V_/_        V_/_        V_/_     
standard    drunken     shocked     noisy    
penguin     penguin     penguin     penguin

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Aug 25 18:29:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:55 EST