[R] Easy cut & paste from Excel to R?
Uwe Ligges
ligges at statistik.uni-dortmund.de
Thu Feb 17 16:19:40 CET 2005
Ken Knoblauch wrote:
> Hi,
>
> I tried the interesting suggestion below, discussed in several postings
> yesterday on the help-list, on my Mac (0S 10.3.7) but could not get it to
> work, as shown in the tests indicated below.
>
>
>>> read.table(file("clipboard"), sep="\t", dec=",")
>>>
Connections to the clipboard are only available on Windows.
Uwe Ligges
>
> If it is obvious (even, if not), can someone tell me what I am doing wrong?
> Do I need to perform an additional operation to open "clipboard", or is this
> option not available on Mac? I did not find any special discussion of this in
> the FAQ nor searching under "clipboard" in the archives. Thank you, in
> advance, for any enlightenment.
>
> data.frame(matrix(rnorm(12),ncol=3))
> X1 X2 X3
> 1 0.4276964 -0.49584891 0.02150469
> 2 -0.8323586 -0.40120649 -1.90733346
> 3 -0.8954563 -1.33195844 -1.28261484
> 4 0.4772382 -0.03703087 0.46719156
> #At this point, I block-marked the printed output and apple-C'd it into the
> clipboard.
> #I then checked the clipboard to verify that the data was indeed copied there.
>
>>read.table("clipboard")
>
> Error in file(file, "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
>>read.table(file("clipboard"))
>
> Error in open.connection(file, "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
>>read.table(file("clipboard","r"))
>
> Error in file("clipboard", "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
>>read.table(file("clipboard","r"),header=TRUE)
>
> Error in file("clipboard", "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
>>read.delim(file("clipboard","r"),header=TRUE)
>
> Error in file("clipboard", "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
>
>>file("clipboard")
>
> description class mode text opened can read
> "clipboard" "file" "r" "text" "closed" "yes"
> can write
> "yes"
>
>
>>file("clipboard","r")
>
> Error in file("clipboard", "r") : unable to open connection
> In addition: Warning message:
> cannot open file `clipboard'
>
> platform powerpc-apple-darwin6.8
> arch powerpc
> os darwin6.8
> system powerpc, darwin6.8
> status
> major 2
> minor 0.1
> year 2004
> month 11
> day 15
> language R
>
> ____________________
> Ken Knoblauch
> Inserm U 371
> Cerveau et Vision
> 18 avenue du Doyen Lepine
> 69675 Bron cedex
> France
> tel: +33 (0)4 72 91 34 77
> fax: +33 (0)4 72 91 34 61
> portable: 06 84 10 64 10
>
> ______________________________________________
> 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
More information about the R-help
mailing list