Visualization of AQI

[This article was first published on Chen-ang Statistics » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The day before yesterday is spring festival which is one of the most famous Chinese festivals, and setting off firecrackers outside on New Year Eve is a traditional custom. However, firecrackers will pollute circumstance severely and cause the hazy weather. Of course the pollution of different province is not the same, and through charts we can view the pollution distribution directly. We use the AQI(Air Quality Index) to measure the air pollution. The real time data are got from Internet.

Package googleVis provides an interface between R and Google Chart Tools. This tools offers interactive charts which can be embedded into web pages. It is convenient that googleVis package allows user to visualise data stored in R data frames with the Google Chart Tools without uploading the data to Google.  The vignettes of this package include more useful details and information. The result as follows(screenshot)


Due to the output is html code that contains the data and references to JavaScript functions hosted by Google, please run the following code and the webpage will be generated. Note that the data only include Chinese mainland.


In addition, if one needs to do some data analysis about meteorology, it is worth mentioning that package RWeather(a new package weatherData has the similar function) enables user to get meteorological data easily from  Yahoo and NOAA. For example,

> getWeatherFromYahoo("10001")
city region country
1 New York NY US

temperature distance pressure speed
1 F mi in mph

chill direction speed
1 42 290 5

humidity visibility pressure rising
1 65 10 30.09 1

sunrise sunset
1 7:03 am 5:13 pm

text code temp date
1 Cloudy 26 44 Sun, 02 Feb 2014 9:50 pm EST
day date low high condition
1 Sun 2 Feb 2014 33 48 Rain/Snow Showers Late
2 Mon 3 Feb 2014 24 34 Snow
3 Tue 4 Feb 2014 33 37 Partly Cloudy
4 Wed 5 Feb 2014 22 37 Rain
5 Thu 6 Feb 2014 18 28 Partly Cloudy


To leave a comment for the author, please follow the link and comment on their blog: Chen-ang Statistics » R. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)