[R] Warning message about closing a connection XXXX

David Winsemius dwinsemius at comcast.net
Wed Jan 4 16:09:53 CET 2012


On Jan 4, 2012, at 9:53 AM, Dan Abner wrote:

> Hello everyone,
>
> After running the following code, I obtain this error message.
>
>
>> mydata <- read.table(textConnection(mystring),
> +    header=TRUE, sep=",",
> +    row.names="id", na.strings=" ")
>> mydata
> Warning message:
> closing unused connection 3 (mystring)
>
> =====
>
> However, when I attempt to run read.table() again and immediately  
> submit
> the close() function (below), I obtain this message:
>
>> close(mystring)
> Error in UseMethod("close") :
>  no applicable method for 'close' applied to an object of class  
> "character"
> =====
>
> How can I avoid the warning message altogether?

?closeAllConnections

The error message occurs because "mystring was never the connection  
name.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list