Skip to content
Prev 33786 / 398513 Next

excel files and R

On 25-Jun-03 Simon Fear wrote:
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 ------------------------------