[R] Can't read xlsx file into R. Seem, Seem to have XLConnect loaded.

Peter Alspach Peter.Alspach at plantandfood.co.nz
Thu May 10 03:46:13 CEST 2012


Tena koe Mike

To possibilities spring to mind:

1. loadedNamespaces() doesn't necessarily give you a list of the packages on the search path.  Try search() instead.

2.  It appears you may be using Word's so-called smart quotes.  Note the difference in the error alert:
Error: unexpected input in "OlPrcFl <- loadWorkbook("".  I'm guessing it is the " which is causing problems, although I haven't used the XLConnect package.

HTH .....

Peter Alspach
 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Mike Hilt
Sent: Thursday, 10 May 2012 10:38 a.m.
To: r-help at r-project.org
Subject: [R] Can't read xlsx file into R. Seem, Seem to have XLConnect loaded.

I have spent hours on R in Windows 7.  Just installed 2 days ago so the R package should be current.



Currently I am using the RGui (64-bit) for Windows.



I can not read an Excel file into R from my computer.  Have hours on this.
 Completely crazy!!



I have the XLConnect package loaded.  I think it is loaded because when I
enter:



> loadedNamespaces()

 [1] "base"          "datasets"      "graphics"      "grDevices"

 [5] "methods"       "rJava"         "stats"         "tools"

 [9] "utils"         "XLConnect"     "XLConnectJars"



XLConnect is listed.  Does that mean it is loaded?



> getwd()

[1] "F:/RwkCB3/R OG SBCD 1205v01"


> list.files()

 [1] "~$ R OG SBCD 1205 MH1.docx"       "~WRL2121.tmp"

 [3] "01 R OG SBCD 1205 MH1 BU1.docx"   "01 R OG SBCD 1205 MH1.docx"

 [5] "01 R OG SBCD 1205v01 BU2"         "Dta1.txt"

 [7] "Gas Dly YTD1204 v01 BU.xlsm"      "Gas Dly YTD1204 v01.xlsm"

 [9] "Oil Dly YTD1204 v01 BU.xlsm"      "Oil Dly YTD1204 v01.xlsm"

[11] "Oil Dly YTD1204 v01.xlsx"         "R OG SBCD 1205v01 sCt.lnk"

[13] "R setwd to C Prog R sCt OtDt.lnk"



So apparently "Oil Dly YTD1204 v01.xlsx" exists in my working directory.



SO WHY DOES THE FOLLOWING BEHAVE THE WAY IT DOES?



> OlPrcFl <- loadWorkbook("Oil Dly YTD1204 v01.xlsx", create = FALSE)

Error: unexpected input in "OlPrcFl <- loadWorkbook(""




I can read an xlsx file in when I do:


> OlPrcFl <- loadWorkbook(file.choose())

That is not a real, long-term solution.


Have same problem installing packages -- Can't get R to load a package when I specify a path.  Works when I use file.choose()




I would really appreciate it if you could tell me what is going on.



Thanks,

Mike Hilt

mikehilt21 at gmail.com

	[[alternative HTML version deleted]]


The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.



More information about the R-help mailing list