This document presents the analysis of the data captured by students from Prospect School during October and November 2016 as part of the Unlocking Curious Minds project “O Tu Kapua”.
The purpose of this analysis is to explore the question “How different is the air around our school?” and the data available for this includes:
# Load libraries
library(openair)
## Loading required package: maps
##
## # maps v3.1: updated 'world': all lakes moved to separate new #
## # 'lakes' database. Type '?world' or 'news(package="maps")'. #
library(RCurl)
## Loading required package: bitops
library(ggplot2)
# Set the seed
set.seed(2001)
# Students' data
student.data <- read.delim("/data/GusData/data/TEMP_AIR/Prospect_children/mobile_data.txt", stringsAsFactors=FALSE)
student.data$date <- as.POSIXct(paste0(student.data$date,' ',student.data$time),format = '%d.%m.%y %H:%M')
names(student.data) <- c('date','time','location','PM10','PM1','Temp.KE','Wind','Notes')
# Weather station data
weather_data <- read.csv("/data/GusData/data/TEMP_AIR/Prospect_children/weather_data.csv")
weather_data$date <- as.POSIXct(paste(weather_data$Date,weather_data$Time), format = '%d/%m/%Y %H:%M:%S')
names(weather_data) <- c('Date','Time','Temp.WS','Temp.min','Temp.max','RH','wd','sdwd','gwd','ws','sdws','gws','date')
To facilitate the display of the results, only the period of time when data from both the students and the weather station is available will be used in this analysis
min_date <- max(min(student.data$date),min(weather_data$date))
max_date <- min(max(student.data$date),max(weather_data$date))
all_data <- subset(merge(student.data,weather_data,by='date',all=TRUE),(date>=min_date & date <=max_date))
One of the purposes of setting up a weather station at the school was to use it as a normalising data source and be able to compare measurements taken at different places and different times by the students. The data was normalised by dividing it by the measurements from the weather station at the same time. Therefore, a Temp.Ratio larger than 1 means that the student measurement was warmer than the weather station and a value smaller than 1 means a student measurement colder than the weather station. Similarly, Wind.Ratio larger than one means a student measuremement faster than the wind at the weather station and Wind.Ratio smaller than 1 means a student measurement slower than the wind at the weather station.
all_data$Temp.Ratio <- all_data$Temp.KE / all_data$Temp.WS
all_data$Wind.Ratio <- all_data$Wind / all_data$ws
ggplot(all_data,aes(x=factor(location),y=PM1))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('PM1')
## Warning: Removed 5930 rows containing non-finite values (stat_summary).
ggsave('pm1_location.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=factor(location),y=PM10))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('PM10')
## Warning: Removed 5930 rows containing non-finite values (stat_summary).
ggsave('pm10_location.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=factor(location),y=Temp.KE))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Temperature Kestrel')
## Warning: Removed 5851 rows containing non-finite values (stat_summary).
ggsave('temp_K_location.png')
## Saving 10 x 5 in image
## Warning: Removed 5851 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=factor(location),y=Temp.WS))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Temperature Weather Station')
ggsave('temp_WS_location.png')
## Saving 10 x 5 in image
ggplot(all_data,aes(x=factor(location),y=Temp.Ratio))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Temperature Ratio')
## Warning: Removed 5851 rows containing non-finite values (stat_summary).
ggsave('temp_ratio.png')
## Saving 10 x 5 in image
## Warning: Removed 5851 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=factor(location),y=Wind))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Wind Kestrel')
## Warning: Removed 5867 rows containing non-finite values (stat_summary).
ggsave('wind_K_location.png')
## Saving 10 x 5 in image
## Warning: Removed 5867 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=factor(location),y=ws))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Wind Weather Station')
ggsave('wind_WS_location.png')
## Saving 10 x 5 in image
ggplot(all_data,aes(x=factor(location),y=Wind.Ratio))+
stat_summary(fun.y="mean", geom="bar")+
aes(fill = factor(location)) +
xlab('Location') +
ylab('Wind Ratio')
## Warning: Removed 5870 rows containing non-finite values (stat_summary).
ggsave('wind_ratio.png')
## Saving 10 x 5 in image
## Warning: Removed 5870 rows containing non-finite values (stat_summary).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=Temp.WS),colour = 'black',alpha = 0.2)+
geom_point(aes(y=Temp.KE,colour = location),size = 5)+
xlab('Date') +
ylab('Temperature')
## Warning: Removed 5851 rows containing missing values (geom_point).
ggsave('temp_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5851 rows containing missing values (geom_point).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=ws),colour = 'black',alpha = 0.2)+
geom_point(aes(y=Wind,colour = location),size = 5)+
xlab('Date') +
ylab('Wind Speed')
## Warning: Removed 5867 rows containing missing values (geom_point).
ggsave('wind_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5867 rows containing missing values (geom_point).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=ws),colour = 'black',alpha = 0.2)+
geom_point(aes(y=PM1,colour = location),size = 5)+
xlab('Date')+
ylab('Wind Speed ; PM1')
## Warning: Removed 5930 rows containing missing values (geom_point).
ggsave('wind_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing missing values (geom_point).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=Temp.WS),colour = 'black',alpha = 0.2)+
geom_point(aes(y=PM1,colour = location),size = 5)+
xlab('Date')+
ylab('Temperature ; PM1')
## Warning: Removed 5930 rows containing missing values (geom_point).
ggsave('pm1_T_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing missing values (geom_point).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=ws),colour = 'black',alpha = 0.2)+
geom_point(aes(y=PM10,colour = location),size = 5)+
xlab('Date')+
ylab('Wind Speed ; PM10')
## Warning: Removed 5930 rows containing missing values (geom_point).
ggsave('pm10_Wind_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing missing values (geom_point).
ggplot(all_data,aes(x=date))+
geom_line(aes(y=Temp.WS),colour = 'black',alpha = 0.2)+
geom_point(aes(y=PM10,colour = location),size = 5)+
xlab('Date')+
ylab('Temperature ; PM10')
## Warning: Removed 5930 rows containing missing values (geom_point).
ggsave('pm10_T_tseries.png')
## Saving 10 x 5 in image
## Warning: Removed 5930 rows containing missing values (geom_point).