[R] trying to import xls or xlsx files

Gabor Grothendieck ggrothendieck at gmail.com
Fri Jun 24 02:09:14 CEST 2011


On Thu, Jun 23, 2011 at 2:00 PM, wwreith <reith_william at bah.com> wrote:
> library(xlsReadWrite)
> mydata<-read.xls("file path", header=TRUE)
>
> however if I change xls to csv it works just fine. Any ideas what I'm doing
> wrong? I have have also using the package gdata with the exact same error.
>
> Below is the error that pops up.
>
> Error in findPerl(verbose = verbose) :
>  perl executable not found. Use perl= argument to specify the correct path.
> Error in file.exists(tfn) : invalid 'file' argument
>

Regarding the read.xls in gdata the error message means that either
perl is not installed or else its not on your path.  If its in
~/bin/perl, say,  then  try:

library(gdata)
DF <- read.xls("myfile", ...whatever..., perl = "~/bin/perl")

or if you are on Windows and its in C:\Perl\bin\perl.exe, say, then try:

library(gdata)
DF <- read.xls("myfile", ...whatever..., perl = "C:\\Perl\\bin\\perl.exe")

Alternately put perl on your path and then you can omit the perl= argument.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list