[R] Trouble with reading xml in R

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed May 1 00:22:33 CEST 2013

On Tue, Apr 30, 2013 at 5:12 PM, Dorte Klerke <dklerke at hotmail.com> wrote:
>  Hi I have been trying for days now to read the contents of this xml file into
> R. I tried the simpler solution xmlToDataFrame, which worked on another
> file, but somehow it doesn't work for this file.

> How is this possible?

 How is this possible without sending us the file? EFORGOTATTACHMENT?

> Also an extra question. My filename is called something like (a new file
> every day)
> BidAskCurves_DE-AU_20130425_20130424130349.xml
> The first part after the "AU" is the current date, this I can generate
> automacticly but I can't generate the last since its the date, time, minute
> and second of the time the data was uploaded from another party to their ftp
> - where I'm getting the data.
> Is there anyway to get R to find the right file, when I can only generate
> part of the file?

 The dir() function has a pattern argument, so you can do:

dir("/myfolder",pattern="BidAskCurves_DE-AU_20130425_[0-9]*.xml") # untested

to list all files that match that pattern in that folder.

the pattern is a 'regular expression', so you might have to
backslashify special characters, but - and _ aren't special.


More information about the R-help mailing list