Book Image

R Data Visualization Cookbook

Book Image

R Data Visualization Cookbook

Overview of this book

Table of Contents (17 chapters)
R Data Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Integrating text with maps


Overlaying maps with text is not a very prominent medium of displaying information. However, in recent times, with the popularity of social networking sites such as Twitter and Facebook, visualizations that integrate text with maps have become somewhat popular. It is possible to extract real-time information using APIs listed in the See also section of this recipe and display them using maps or some other medium. We have discussed the idea of extracting information from the Web using XML in the recipe A basic introduction to API and XML in Chapter 10, Creating Applications in R.

In this recipe, we will briefly discuss how one can plot text over maps. Readers are encouraged to use the twitteR package to extract information and follow this recipe to generate similar visualizations.

Getting ready

To generate the map in R, we need to install and load the maps package:

install.packages("maps")
library(maps)

How to do it…

We will import our data in R using the read.csv() function...