[R-SIG-Mac] R-SIG-Mac] Clipboard
ken knoblauch
knoblauch at lyon.inserm.fr
Wed May 16 13:20:06 CEST 2007
read.table("clipboard") still works on my R 2.4.1 if you have x11 open,
but not
if you don't.
From a thread that appeared on the r-devel list that I can't locate
just now,
it's apparently not that obvious how to extend this generally to the
Mac although that
might chance in the future.
> Hi there,
>
> This command to use the clipboard as a data source used (pre 2.4?)
> to work on OS X:
>
> my.data <- read.table(file("clipboard"),header=TRUE)
> > OR JUST
> my.data <- read.table("clipboard", header=TRUE)
>
> Now (2.5) the above forms generate an error
>
> > Error in open.connection(file, "r") : unable to open connection
> > In addition: Warning message:
> > Clipboard cannot be opened or contains no text
>
>
> And instead we have to do:
>
> my.data <- read.table(pipe("pbpaste"), header=TRUE)
>
>
> I wonder as this is quite a nice feature, and widely used, if the PC
> version
> should not be emulated on the mac (i.e., both the os x terminology
> "pbpaste"
> and the generic and user friendly "clipboard" work?
>
> It would seem especially valuable as it will help scripts stay
> cross-platform. The only drawback i can see if that you couldn't access
> files called "clipboard" stored in the target directory, but that
> seems no
> practical loss.
>
> Tim
More information about the R-SIG-Mac
mailing list