; -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger D. Peng
> Sent: Thursday, 15 November 2007 11:48 PM
> To: Prof Brian Ripley
> Cc: R-devel mailing list
> Subject: Re: [Rd] isOpen on closed connections
>
> Upon further con
Upon further consideration, I realized there is a philosophical element
here---if a connection is closed and hence does not exist, is it open?
The practical issue for me is that when you do something like
close(con)
the 'con' object is still lying around and is essentially undefined. For
exam
My solution the original post is to always set 'con <- NULL' after closing a
connection, and then test for NULL. This is how I do to make sure to make
sure that opened connections are closed and as soon as possible.
foo <- function(...) {
con <- file("foo.R", open="r"):
on.exit({
if (!is.
I think the confusion here is over close(): that closes *and destroys* a
connection, so it no longer exists.
isOpen applies to existing connections: you cannot close but not destroy
them at R level, but C code can (and does). You will see it in use in the
utils package.
On Wed, 14 Nov 2007,
"Roger D. Peng" <[EMAIL PROTECTED]> writes:
> As far as I can tell, 'isOpen' cannot return FALSE in the case when 'rw =
> ""'.
> If the connection has already been closed by 'close' or some other function,
> then isOpen will produce an error. The problem is that when isOpen calls
> 'getConnec