Getting Started with XML and JSON
The goal of this chapter is to provide a rapid introduction to a few high-level functions available to R users for parsing XML and JSON content. In many cases, these functions (read- HTMLTable(), xmlToList(), xmlToDataFrame(), and fromJSON()) are all that you will need to read XML- or JSON- formatted data directly into an R list or dataframe. One of the purposes of this chapter is to introduce many of the functions you need for common applications for scraping data from Web pages, reading data from files, and working with XML and JSON data from Web services. We also want to give you a sense of the possibilities and entice you to learn more about these data formats.
Unable to display preview. Download preview PDF.
- Civic Impulse, LLC. GovTrack.us developer documentation. http://www.govtrack.us/developers, 2012.
- Alex Couture-Beil. rjson: Converts R object into JSON and vice-versa. http://cran.rproject.org/web/packages/rjson/, 2011. R package version 0.2.6.
- JSON Advocate Group. Introducing JSON: A lightweight data-interchange format. http://www.json.org/, 2006.
- Kiva Organization. Kiva: Loans that change lives. http://www.kiva.org/, 2011.
- R Development Core Team. R: A Language and Environment for Statistical Computing. Vienna, Austria, 2012. http://www.r-project.org.
- John Simpson. XPath and XPointer: Locating Content in XML Documents. O’Reilly Media, Inc., Sebastopol, CA, 2002.Google Scholar
- Duncan Temple Lang. XML: Tools for parsing and generating XML within R and S-PLUS. http://www.omegahat.org/RSXML, 2011. R package version 3.4.
- Wikimedia Foundation. Wikipedia: The free encyclopedia. http://en.wikipedia.org/wiki/Main_Page, 2011.
- Worldwide Web Consortium. Extensible Markup Language (XML) 1.0. http://www.w3.org/TR/REC-xml/, 2008.