[R] problems reading XML type file from ishares website

Bos, Roger roger.bos at rothschild.com
Thu Jul 28 15:14:28 CEST 2016


The ishares website has the S&P 500 stocks you can download as a XLS file, which opens fine in Excel, but I am not able to open it in R due to what seems to be invalid XML formatting.   I tried using XLConnect and XML as shown below.  Does anyone know a workaround or can point out what I am doing wrong.  Here is my reproducible code:

temp <- "https://www.ishares.com/us/239726/fund-download.dl"
fname <- "ivv.xls"
download.file(url = temp, destfile = fname)
readWorksheetFromFile(fname)
library(XML)
xmlfile <- xmlTreeParse(fname)

09:06:17 > readWorksheetFromFile(fname)
Error: InvalidFormatException (Java): Your InputStream was neither an OLE2 stream, nor an OOXML stream
09:06:17 > library(XML)
09:06:25 > xmlfile <- xmlTreeParse(fname)
Opening and ending tag mismatch: Style line 14 and Style
Error: 1: Opening and ending tag mismatch: Style line 14 and Style


Thanks in advance, Roger







This message and any attachments are for the intended recipient's use only.

This message may contain confidential, proprietary or legally privileged

information. No right to confidential or privileged treatment

of this message is waived or lost by an error in transmission.

If you have received this message in error, please immediately

notify the sender by e-mail, delete the message, any attachments and all

copies from your system and destroy any hard copies.  You must

not, directly or indirectly, use, disclose, distribute,

print or copy any part of this message or any attachments if you are not

the intended recipient.

	[[alternative HTML version deleted]]



More information about the R-help mailing list