[R] Warning message about closing a connection XXXX

peter dalgaard pdalgd at gmail.com
Wed Jan 4 19:51:16 CET 2012


On Jan 4, 2012, at 19:21 , Duncan Murdoch wrote:

> On 12-01-04 12:25 PM, Prof Brian Ripley wrote:
>> 
>> 
>> Rather than using a sledgehammer, use showConnections(all=TRUE) to see
>> all connections, and close the ones you want to (and its help page shows
>> you how).
> 
> In older versions that do give the warning, wouldn't it be sufficient to name the textConnection, and close it explicitly?  E.g.
> 
> mydata<- read.table(con <- textConnection(mystring),  header=TRUE, sep=",",   row.names="id", na.strings=" ")
> 
> close(con)
> 

Or, in recent versions, use the tools designed for the purpose and do

mydata <- read.table(text=mystring, ....)


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list