On Tue, 28 Apr 2009, Jamie.lannister wrote:


Hi I'm a mac user. I have problems loading data from mac excel in R.
I'm using these script:
library(utils)
data2 <- read.table(file("clipboard"), header =T, sep ="\t")
____but this is the message that I have from R_____
Error in open.connection(file, "r") : cannot open the connection
In addition: Warning message:
In open.connection(file, "r") :
 clipboard cannot be opened or contains no text

More complicate then that is that sometimes it works sometimes no.......
I'm very confuse.... any help?

See the help for 'file'. It says (on a Mac) that file("clipboard") reads the 'X11 primary selection', and also says

     Mac OS X users can use 'pipe("pbpaste")' and 'pipe("pbcopy", "w")'
     to read from and write to that system's clipboard.

The problem is that most windows managers on Unix-alikes have multiple clipboards and working out which text is in which clipboard is tricky, not least as some applications (and some window managers) try to be helpful and copy to more than one clipboard. That's why this may sometimes appear to work and sometimes not.

--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
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

______________________________________________
R-help@r-project.org 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.

Reply via email to