Skip to content
Prev 76118 / 398502 Next

how to close connections?

Try this

con <- gzfile("file.gz")
a <- readLines(con, n=1)
showConnections(all=TRUE)
close(con)
showConnections(all=TRUE)

So the connection is opened and closed as it says, but not destroyed.
You do need to call close() explicitly -- from the help file

      'close' closes and destroys a connection.
                     ^^^^^^^^^^^^

There are  'create - open - close - destroy'  states for a connection.
On Thu, 25 Aug 2005, Ott Toomet wrote: