[R] Easy cut & paste from Excel to R?

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Feb 16 11:42:15 CET 2005


Peter Dalgaard wrote:

> Uwe Ligges <ligges at statistik.uni-dortmund.de> writes:
> 
> 
>>Werner Wernersen wrote:
>>
>>
>>>Hi!
>>>Is it possible to easily cut & paste data from an
>>>Excel spreadsheet to an R edit( ) grid or to variable?
>>>It seems that R cannot handle the cell delimiters
>>>Excel hands over.
>>>Regards,
>>>  Werner
>>>______________________________________________
>>>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
>>
>>copy in Excel and say in R:
>>read.table(file("clipboard"))
> 
> 
> Er, doesn't that want to be read.delim (or read.delim2 in
> "comma-locales")? Plain read.table() could cause some grief if there
> are empty cells.
> 


Well, yes, some arguments twisting might be required as for my german 
locales / german version of Excel the following works even for empty 
cells and real valued entries:

   read.table(file("clipboard"), sep="\t", dec=",")

    V1  V2  V3
1 1.2  NA 2.3
2 3.4 4.5 5.6


Uwe Ligges




More information about the R-help mailing list