0

I am downloading the zip files from the location http://nemweb.com.au/Data_Archive/Wholesale_Electricity/NEMDE/2019/NEMDE_2019_03/NEMDE_Market_Data/NEMDE_Files/NemPriceSetter_20190301_xml.zip

The zip file has multiple xml files inside which iam trying to read but based on the style of the XML file I cannot parse it properly and cannot convert that into a data frame

I have tried to download the zip file into a temporary directory and then tried parsing one file at a time

library(xml2)
library(tidyverse)

tf <- tempfile(tmpdir = tdir <- tempdir())
download.file("http://nemweb.com.au/Data_Archive/Wholesale_Electricity/NEMDE/2019/NEMDE_2019_03/NEMDE_Market_Data/NEMDE_Files/NemPriceSetter_20190301_xml.zip", tf)
xml_files <- unzip(tf, exdir = tdir)

library(XML)

doc<-xmlParse(xml_files[1])
a<-xmlToDataFrame(nodes=getNodeSet(doc,"//SolutionAnalysis/PriceSetting"))

unlink(tdir, T, T)

This is how the XML file looks enter image description here

and I am trying to put the information in a specific column using a data frame

jogo
  • 12,469
  • 11
  • 37
  • 42
Sara
  • 49
  • 8

0 Answers0