[R] MS Excel Data
gunter.berton at gene.com
Fri Nov 30 01:37:49 CET 2007
Better yet! Thanks Gabor.
From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com]
Sent: Thursday, November 29, 2007 12:10 PM
To: Bert Gunter
Cc: r-help at r-project.org
Subject: Re: [R] MS Excel Data
On Nov 29, 2007 3:01 PM, Bert Gunter <gunter.berton at gene.com> wrote:
> This has been discussed on this list many times before. Google on "Import
> Excel R". Note also that there are potential problems (loss of digits) due
> to Excel "idiosyncracies" depending on what you do.
> http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html provides
> some details.
> Finally, I have found that for rectangular data sets with no missing
> in Excel (tables), cutting and read.tabling **the data only ** is a
> simple(but probably not without risk) way to do it:
> (after cutting the data only in Excel to the clipboard) in R:
> newdat <- read.table("clipboard", head=FALSE, row.names=NULL)
> The columns can then be named via names(newdat) <- ...
> I omit column headers because in most of the Excel data I get the column
> names have spaces and other non-alphanumeric characters which R cannot
> easily digest. One could separately scan() just the vector of column
> and use regular expressions to extract the names. But for small tables, I
> find it easier just to create the names manually.
You can include headers with spaces in the copy with:
DF <- read.delim("clipboard")
More information about the R-help