[R] Importing data from clipboard on Mac OSX
Rob J Goedman
goedman at mac.com
Sun Aug 27 01:38:55 CEST 2006
Hi Rense,
Not sure how robust this is, but maybe to get you started:
In R console:
> a <- 1:10
Copy that line to or part of it to the clipboard.
> system("osascript -e 'set y to the clipboard' -e 'tell application
\"R.app\" to cmd y'")
If course you could use this in an R function. I would opt for using
a file to read in the data.
As this is Mac specific, maybe a better list is R-SIG-Mac.
Rob
On Aug 26, 2006, at 4:00 PM, Rense Nieuwenhuis wrote:
> Dear R users,
>
> I am trying to get data from the clipboard into R on MacOSX. I tried
> the following, but got an error message:
>
> read.delim("clipboard")
> Error in file(file, "r") : unable to open connection
> In addition: Warning message:
> unable to contact X11 display
>
> Obviously, I'm not running R using X11. I'm wondering, can I import
> data from the clipboard on MacosX?
>
> Thanks in advance,
>
> Rense Nieuwenhuis
>
>> version
> _
> platform powerpc-apple-darwin8.6.0
> arch powerpc
> os darwin8.6.0
> system powerpc, darwin8.6.0
> status
> major 2
> minor 3.0
> year 2006
> month 04
> day 24
> svn rev 37909
> language R
> version.string Version 2.3.0 (2006-04-24)
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list