Interacting, on demand, with 2012 best cities data and plotting different graphs —- Experiments with ggplot2 on shiny server

April 25, 2013

(This article was first published on Adventures in Analytics and Visualization, and kindly contributed to R-bloggers)

Data from slides on Bloomberg businessweek’s site:

In this post, I show how one can interact with a dataset and generate graphs on the fly (technically, I’ve predetermined which graphs to create, but it should not be difficult to build a menu of possible graphs). This required setting up the shiny server running on Ubuntu. This current server is being hosted by Gonzaga. Big thanks to Bob Toshack for help in trying to get the server public. Work in progress. In the meanwhile, I am using the services provided by RStudio for hosting this. Thanks a ton, RStudio, for this opportunity and the wonderful set of tools you have. And I am getting tired of this best cities dataset. So, the last few apps using that. Please click on the pictures below to go to the site and play with it. Remember to come back to go to the next set of interactive graphs.

1. Generating bar plots and/or dot plots of any variable you choose (from the preloaded data).

2. Comparing distributions of two different variables (can be extended to more than 2 variables) using their bar graphs (can use other graphs as well).

3. Exploring the relationship between two different variables for cities of different ranks.Scatter plots of rank of cities, by two variables.

4. Extending the above scatter plot to simultaneously see two scatter plots and four variables.

To leave a comment for the author, please follow the link and comment on their blog: Adventures in Analytics and Visualization. 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...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training


CRC R books series

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)