Description Usage Arguments Details Value Author(s) Examples
Downlaod AirBox data from Data.Taipei
| 1 | read.AirBox(x = 0)
 | 
| x | numeric in 0, 1; the type of AirBoxData to be downloaded. 
 | 
The airbox data are dowload from Data.Taipe from the following link http://data.taipei/opendata/datalist/datasetMeta?oid=4ba06157-3854-4111-9383-3b8a188c962a
a list containing AirBox data and device information
Chih-Lin Wei
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Download hourly instant AirBox data
system.time(d <-read.AirBox(0))
# 7 day average of PM 2.5 at elementary school
library(doBy)
library(ggplot2)
avg <- summaryBy(s_d0~school, data=d, FUN=c(mean, sd))
avg <- na.omit(avg)
od <- order(avg$s_d0.mean, decreasing=TRUE)
avg$school <- factor(avg$school, levels=avg$school[od])
Sys.setlocale(category = "LC_ALL", locale = "cht")
# Air quality ranks for elementary school in Taipei
ggplot(avg, aes(x=school, y=s_d0.mean)) +
  geom_point(stat = "identity")+
  geom_errorbar(aes(x=school, ymin=s_d0.mean-s_d0.sd, ymax=s_d0.mean+s_d0.sd))+
  xlab("")+ylab("PM 2.5")+
  coord_flip()+
  theme_bw()
# Time series of top 5 most polluted elementary school
sub <- subset(d, school==levels(avg$school)[1] | school==levels(avg$school)[2] | school==levels(avg$school)[3]| school==levels(avg$school)[4]| school==levels(avg$school)[5])
ggplot(data=sub, aes(x=time, y=s_d0, colour=school))+
  geom_line()+
  ylab("PM 2.5")+
  theme_bw()+
  theme(axis.text.x = element_text(angle = 90, hjust = 1))
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.