Easy cut & paste from Excel to R? 2005-02-16 - By Uwe Ligges
Peter Dalgaard wrote:
> Uwe Ligges <ligges@(protected)> 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@(protected) 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
______________________________________________ R-help@(protected) mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
|
|