I'm an R newbie and had a question about the read.xls function. I've heard that this is often not a reliable function to use for importing data. However, I have created numerous xls files which contain information about voter turnout and macroeconomic indicators in India. I'm writing a paper on the relationship between economic growth and voter turnout. This is the command I use: data <- read.xls("India.xls", header=TRUE) I get the following error message: Error: could not find function "read.xls" Anyone have ideas? Thanks, Abraham
On Sat, 14 Mar 2009, Mathew, Abraham T wrote:> I'm an R newbie and had a question about the read.xls function. I've heard that this is often not a reliable function to use for importing data. However, I have created numerous xls files which contain information about voter turnout and macroeconomic indicators in India. I'm writing a paper on the relationship between economic growth and voter turnout. > > This is the command I use: > > data <- read.xls("India.xls", header=TRUE) > > I get the following error message: > Error: could not find function "read.xls" > > > Anyone have ideas? > Thanks, > Abraham > >Since you are a beginner it is possible you missed a couple of steps. read.xls is part of the package xlsReadWrite so you need to first install that package, which is only possible if you are using Windows. Then you need to load the package with the command library(xlsReadWrite) Just checking on CRAN xlsReadWrite is not currently available. There is an archived version available however. David Scott _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 373 7599 ext 85055 Fax: +64 9 373 7018 Email: d.scott at auckland.ac.nz Graduate Officer, Department of Statistics Director of Consulting, Department of Statistics
To turn the function avaliable you have to load the library first, to do so: library(xlsReadWrite) Then you use your command read.xls. I'm suposing that you already had installed the xlsReadWrite package. A better alternative to this package is RODBC, which also read excel 2007 files. Take a look on it at the CRAN web site. Hope it helps. Best wishes. ______________ Rodrigo Aluizio Em 15/03/2009, ?s 00:27, "Mathew, Abraham T" <amathew at ku.edu> escreveu:> I'm an R newbie and had a question about the read.xls function. I've > heard that this is often not a reliable function to use for > importing data. However, I have created numerous xls files which > contain information about voter turnout and macroeconomic indicators > in India. I'm writing a paper on the relationship between economic > growth and voter turnout. > > This is the command I use: > > data <- read.xls("India.xls", header=TRUE) > > I get the following error message: > Error: could not find function "read.xls" > > > Anyone have ideas? > Thanks, > Abraham > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
There are two read.xls functions: one is in gdata and one is in xlsReadWrite packages and neither is unreliable. You've simply not loaded the package. There is more info here and interfacing to Excel: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows You should read the Introduction manual and see ?library for loading a package. On Sat, Mar 14, 2009 at 11:27 PM, Mathew, Abraham T <amathew at ku.edu> wrote:> I'm an R newbie and had a question about the read.xls function. I've heard that this is often not a reliable function to use for importing data. However, I have created numerous xls files which contain information about voter turnout and macroeconomic indicators in India. I'm writing a paper on the relationship between economic growth and voter turnout. > > This is the command I use: > > data <- read.xls("India.xls", header=TRUE) > > I get the following error message: > Error: could not find function "read.xls" > > > Anyone have ideas? > Thanks, > Abraham > > > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >