[R] excel files and R

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Wed Jun 25 13:20:54 CEST 2003


On 25-Jun-03 Simon Fear wrote:
> [...] I think I just want to get the data from Excel ('cos that's how
> it nearly always comes), but I don't want to process it in Excel, when
> I have R ...

In that case there is a very simple solution (asuming you have access
to Excel).

Open the Excel file in Excel, and save it out as a comma-separated file
(.csv). You may need to clean this up a bit (depending on how sloppily
it was created -- a lot of people create very messy Excel files), but
usually you don't. (For the same reason, it can be best to do the export
to CSV yourself, rather than asking the sender to send you a CSV file,
unless you trust their competence.)

Then, in R, do something like

  X <- read.csv("excelfile.csv")

You will then have a dataframe X (with variables named as in the column
names in the Excel file).

This is what I always do when I get Excel files; it has always worked.

See ?read.csv for options.

Best wishes,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 25-Jun-03                                       Time: 12:20:54
------------------------------ XFMail ------------------------------




More information about the R-help mailing list