Chinese air polution is quite serious recently. At last, in this spring, the air polution has been invading Japan. Many municipal agencies in Japan have began to observe the pollutant, namely particulate matter under 2.5μm (PM 2.5), to guard resident’s health.
I’m checking the PM 2.5 concentration every day in the web page (Fig. 1), because I do not want to jog at outdoor when the concentration is high. A problem is the agency’s web page has too many information. That prevents quick watching. So I want to convert the data into a nice looking chart.
First, I thought I had to write some R programs to complete that. But I was wrong. Thanks to the CRAN (http://cran.r-project.org) and the contributors, there is already a package to do that.
Here I show the procedure to get a web page, parse it, and finally draw a chart.
I need the sixth table and the 1st row must be ignored.
Also, I must specify the column type explicitly to convert hyphens into the NA value.
Now, make the look better, and enable Japanese fonts. (referring to http://kohske.wordpress.com/2011/02/26/using-cjk-fonts-in-r-and-ggplot2/ for the font setting)
quartzFonts(HiraMaru=quartzFont(rep("HiraMaruProN-W4", 4))) par(family="HiraMaru") plot(pm.2.5.ibaraki,main="PM2.5 Air Polution Come From China (μg/㎥)",cex.axis=0.8)