Clipboard connections (PR#8668)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Clipboard connections (PR#8668)

graywh
Full_Name: Will Gray
Version: R 2.2.1
OS: WinXP SP2
Submission from: (NULL) (160.129.18.69)


I've been using R with a text editor (Tinn-R) and using a feature of the editor
that sends code to a running R session.  Sometimes it is convenient to use the
command "source(file('clipboard'))" to send whole blocks of code.  However, this
quickly fills up the limit of 50 connections, even if 47 are closed.  What does
R hold on to connections it doesn't need, and especially multiple closed
connections to the clipboard?  Should this be changed?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Clipboard connections (PR#8668)

Brian Ripley
This is not a bug, but user error.  You are failing to close the
connection.  R has no idea you do not subsequently want to use the
connection via getConnection.  As the help page ?file and its reference,
and also the R-news article on connections.

The correct usage is either

source("clipboard")

or

zz <- file("clipboard")
source(zz)
close(zz)

BTW, there are no `clipboard connections': there are file connections to
the clipboard on Windows only.


On Wed, 8 Mar 2006, [hidden email] wrote:

> Full_Name: Will Gray
> Version: R 2.2.1
> OS: WinXP SP2
> Submission from: (NULL) (160.129.18.69)
>
>
> I've been using R with a text editor (Tinn-R) and using a feature of the editor
> that sends code to a running R session.  Sometimes it is convenient to use the
> command "source(file('clipboard'))" to send whole blocks of code.  However, this
> quickly fills up the limit of 50 connections, even if 47 are closed.  What does
> R hold on to connections it doesn't need, and especially multiple closed
> connections to the clipboard?  Should this be changed?
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel