[R] How to read Excel file and access the data item?

Na Li nali at umn.edu
Wed Mar 3 21:20:55 CET 2004


On 3 Mar 2004, Grace Conlon verbalised:

> In R, How to read Excel file and access the data item?
> Thank you.

The catdoc package (http://www.45.free.net/~vitus/ice/catdoc/) includes
a program xls2csv that converts xls to csv (comma separated value) files.

In a Unix-like system, I often do

blah <- read.csv (pipe ("xls2csv somefile.xls"))

that saves the intermediate step of creating a csv file.  

An Excel file can have irregular cells (descriptions, graphs, etc) and
multiple sheets (xls2csv puts all sheets in one file, consecutively). You
need watch out for those and double check to make sure you are reading the
correct data.

I am not sure how good xls2csv is in handling xls files with formula
though.

Michael




More information about the R-help mailing list