On Jan 21, 2010, at 8:44 AM, Jerry Floren wrote:


Hi Gabor,

Perhaps I am missing something in my file names that I just can't see.
Whenever I have had problems reading a file into R, it always has been
because of some typo that I have made.

## This is what I am trying to run. The worksheet is the third one.
Originally it was named "Paste Special", but I changed it to "Sheet3". The
first cell (A1) on Sheet3 is named "NAPT_ID"

Is it named NAPT_ID" or does it contain that string?

(If it's the A1 cell, why not omit the pattern argument altogether?)

--
David.


library(gdata)
DF <- read.xls("C:/TestR", pattern = "NAPT_ID", sheet=3, as.is = TRUE)


This is the error message I get:

library(gdata)

Attaching package: 'gdata'


       The following object(s) are masked from package:utils :

        object.size

DF <- read.xls("C:/TestR", pattern = "NAPT_ID", sheet=3, as.is = TRUE)
Converting xls file to csv file... Error in system(cmd, intern = ! verbose) :
perl not found
Error in file.exists(tfn) : invalid 'file' argument


## Here is an example file name from "file.choose()" in this directory

file.choose()
[1] "C:\\TestR\\MAP_2009Round2_2002Soiltest9-21-09.xls"
file.choose()
[1] "C:\\TestR\\MAP_2009Round2_2006BestTest10-2-09.xls"
file.choose()
[1] "C:\\TestR\\MAP_2009Round2_4006A&LWestern10-1-09.xls"

I ran it again after removing all the Excel files in this directory except
the three listed above and had similar error messages:

library(gdata)
DF <- read.xls("C:/TestR", pattern = "NAPT_ID", sheet=3, as.is = TRUE)
Converting xls file to csv file... Error in system(cmd, intern = ! verbose) :
perl not found
Error in file.exists(tfn) : invalid 'file' argument


Next, I renamed the Excel files to simpler names and also removed all the worksheets except the one with the data I needed. I renamed that one Sheet1 instead of "Paste Special". With these changes, I simplified the expression,
but I am still getting the same error messages.

DF <- read.xls("C:/TestR", as.is = TRUE)
Converting xls file to csv file... Error in system(cmd, intern = ! verbose) :
perl not found
Error in file.exists(tfn) : invalid 'file' argument


Thanks,

Jerry Floren
Minnesota Department of Agriculture
--
View this message in context: 
http://n4.nabble.com/Yet-another-question-about-importing-Excel-xls-files-tp1018699p1049735.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to