Mapping locations in R with the Data Science Toolkit

May 18, 2011

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Pete Warden's Data Science Toolkit (which we mentioned briefly last week) is an open-source information server that provides an API you can query for information useful for building data science applications, like identifying proper names in unstructured text, or converting IP addresses to lat/long coordinates. You can make queries via the Web interface or by direct interface to the API, but for R users Ryan Elmore has made the process much simpler by providing a package of R functions to make queries directly from R. The package, RDSTK, is currently available in source form on github; Ryan provides details and installation instructions on his blog, and you can the list of functions provided in the user manual.

Inspired by FlowingData's airline flight network charts (for which a handy step-by-step guide for producing such maps with great circles in R is now available), Ryan gave a presentation at the Denver R User Group[*] where he used the street2coordinates function of his RDSTK package to convert the hometowns of user group members (supplied in text form, like my own home town of "Adelaide, Australia") into geographic coordinates, and display them on a map with Great Circles emanating from Denver:

Denver RUG member locations

Check out Ryan's slides for more examples of using the Data Science Toolkit from R, and if you're thinking about using R to interface to an API it's also a great example of interfacing with R via POST queries, JSON, and Curl.

[*] The Denver RUG is proudly sponsored by Revolution Analytics.

The Log Cabin: The RDSTK Presentation at Denver R Users Group

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Dommino data lab

Quantide: statistical consulting and training



CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)