Retrieve CPI from

March 13, 2016


Report Abuse
This experiment dynamically retrieves XML data from for CPI and converts XML to data.frame
This experiment uses XML library to retrieve CPI data in XML format using APIs as described [][1]. This experiment then finds the number of records in the XML using XMLSize command. Once it knows the total records, it parses each record and converts each record to individual row of Year, Month and CPI values. It uses XMLParse to parse the HTML content. It uses XMLRoot to find the root of XML and then it traverses each node to retrieve specific elements such as Year, Month and CPI. It uses XMLToList to convert the final XML leaf node to list which is then converted to the numeric value. [1]: