[R] Yet another question about importing Excel *.xls files
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Jan 21 00:57:59 CET 2010
It may also be that path names with spaces in them are not supported.
Try it using a path that has no spaces in it.
On Wed, Jan 20, 2010 at 6:43 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Wed, Jan 20, 2010 at 6:01 PM, Jerry Floren <jerry.floren at state.mn.us> wrote:
>> Next, I tried Gabor's code, which is so much more compact:
>>
>> ### Start of Gabor's code ###
>> library(gdata)
>> DF <- read.xls(U, pattern = "SAMPLE", as.is = TRUE)
>> ## End of Gabor's code ##
>>
>> Is "U" the directory and path? Is "SAMPLE" the .XLS worksheet name (Paste
>> Special) that I want R to read?
>
> Yes, U is the path/filename. SAMPLE is the pattern. All rows prior to
> the first row with a cell containing the text SAMPLE are ignored.
>
> You can specify the sheet number in the sheet= argument but there is
> no facility for specifying the sheet name. e.g.
>
> DF <- read.xls(U, pattern = "SAMPLE", sheet = 2, as.is = TRUE)
>
> If you only know the sheet name but not the position then you are
> better off using one of the other methods.
>
>>
>> ## The following are the error messages: ##
>>
>>> library(gdata)
>>
>> Attaching package: 'gdata'
>>
>>
>> The following object(s) are masked from package:utils :
>>
>> object.size
>>
>>> DF <- read.xls("C:/Documents and Settings/jfloren/My Documents/Test_R",
>>> pattern = "Paste Special", 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
>
> There is something wrong with your file specification. Maybe its
> really ends in Test_R.xls? Enter
>
> file.choose()
>
> on a line by itself and use the resulting browser to find the file and
> then see what it outputs as its path/name.
>
>>>
>>> ls()
>> character(0)
>>>
>>
>> ## End of error messages ##
>>
>> Thanks for all of your help. Time to go home for the night.
>>
>> Thanks,
>>
>> Jerry Floren
>> Minnesota Department of Agriculture
>>
>>
>>
>> --
>> View this message in context: http://n4.nabble.com/Yet-another-question-about-importing-Excel-xls-files-tp1018699p1020039.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>>
>
More information about the R-help
mailing list