Skip to main content

Getting Started with XML and JSON

  • Chapter
  • First Online:
  • 12k Accesses

Part of the book series: Use R! ((USE R))

Abstract

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.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Civic Impulse, LLC. GovTrack.us developer documentation. http://www.govtrack.us/developers, 2012.

  2. 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.

  3. JSON Advocate Group. Introducing JSON: A lightweight data-interchange format. http://www.json.org/, 2006.

  4. Kiva Organization. Kiva: Loans that change lives. http://www.kiva.org/, 2011.

  5. R Development Core Team. R: A Language and Environment for Statistical Computing. Vienna, Austria, 2012. http://www.r-project.org.

  6. John Simpson. XPath and XPointer: Locating Content in XML Documents. O’Reilly Media, Inc., Sebastopol, CA, 2002.

    Google Scholar 

  7. Duncan Temple Lang. RJSONIO: Serialize R objects to JSON (JavaScript Object Notation). http://www.omegahat.org/RJSONIO, 2011. R package version 0.95.

  8. 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.

  9. Wikimedia Foundation. Wikipedia: The free encyclopedia. http://en.wikipedia.org/wiki/Main_Page, 2011.

  10. Worldwide Web Consortium. Extensible Markup Language (XML) 1.0. http://www.w3.org/TR/REC-xml/, 2008.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer Science+Business Media New York

About this chapter

Cite this chapter

Nolan, D., Lang, D.T. (2014). Getting Started with XML and JSON . In: XML and Web Technologies for Data Sciences with R. Use R!. Springer, New York, NY. https://doi.org/10.1007/978-1-4614-7900-0_1

Download citation

Publish with us

Policies and ethics