library(plyr)
library(dplyr)
library(tidyr)
library(ggplot2)
library(knitr)Mis_Data<-read.csv("C:/Users/vivek/Documents/GlobalLandTemperatures/GlobalLandTemperaturesByState.csv", header = T)
Mis_Data %>%
separate(col = dt, into = c("Year", "Month", "Day"), convert = TRUE) ->Mis_Data
Mis_Data<-na.omit(Mis_Data)
clim_data<-Mis_Data
kable(clim_data[1:10,1:7])| Year | Month | Day | AverageTemperature | AverageTemperatureUncertainty | State | Country |
|---|---|---|---|---|---|---|
| 1855 | 5 | 1 | 25.544 | 1.171 | Acre | Brazil |
| 1855 | 6 | 1 | 24.228 | 1.103 | Acre | Brazil |
| 1855 | 7 | 1 | 24.371 | 1.044 | Acre | Brazil |
| 1855 | 8 | 1 | 25.427 | 1.073 | Acre | Brazil |
| 1855 | 9 | 1 | 25.675 | 1.014 | Acre | Brazil |
| 1855 | 10 | 1 | 25.442 | 1.179 | Acre | Brazil |
| 1855 | 11 | 1 | 25.400 | 1.064 | Acre | Brazil |
| 1855 | 12 | 1 | 24.100 | 1.718 | Acre | Brazil |
| 1856 | 1 | 1 | 25.814 | 1.159 | Acre | Brazil |
| 1856 | 2 | 1 | 24.658 | 1.147 | Acre | Brazil |
#extracting Data for state of Missouri
clim_data %>%
filter(Country=="United States") %>%
filter(State=="Missouri")->clim_datac
#omitting na values
clim_datac<-na.omit(clim_datac)
kable(clim_datac[1:5,1:7])| Year | Month | Day | AverageTemperature | AverageTemperatureUncertainty | State | Country |
|---|---|---|---|---|---|---|
| 1743 | 11 | 1 | 5.310 | 3.440 | Missouri | United States |
| 1744 | 4 | 1 | 14.466 | 3.482 | Missouri | United States |
| 1744 | 5 | 1 | 17.634 | 3.402 | Missouri | United States |
| 1744 | 6 | 1 | 23.033 | 3.427 | Missouri | United States |
| 1744 | 7 | 1 | 25.052 | 3.394 | Missouri | United States |
# Finding Average Temperatures
clim_datac %>%
filter(Year>1742) %>%
group_by(Year) %>%
summarise(Temperature = mean(AverageTemperature)) ->clim_data2qplot(Year, Temperature, data=clim_data2, main="Missouri Average Temperature \n 1744-Present",geom=c("point","smooth"))+ aes(colour = Temperature) + scale_color_gradient(low="blue", high="red")## `geom_smooth()` using method = 'loess'
The above graph doesn’t capture the gravity of the situation. Let us dig deeper into the time lines.To see from which point in time the temperature rise started happening.
# Finding Average Temperatures years 1900- Present
clim_datac %>%
filter(Year>1900) %>%
group_by(Year) %>%
summarise(Temperature = mean(AverageTemperature)) ->clim_data2qplot(Year, Temperature, data=clim_data2, main="Missouri Average Temperature \n 1900-Present",geom=c("point","smooth"))+ aes(colour = Temperature) + scale_color_gradient(low="blue", high="red")## `geom_smooth()` using method = 'loess'
This graph seems much better! We clearly see the trend in rising temperatures.
clim_datac %>%
filter(Year>1950) %>%
group_by(Year) %>%
summarise(Temperature = mean(AverageTemperature)) ->clim_data2This is more clear shows and shows a gradual rise in temperatures.
qplot(Year, Temperature, data=clim_data2, main="Missouri Average Temperature \n 1950-Present",geom=c("point","smooth"))+ aes(colour = Temperature) + scale_color_gradient(low="blue", high="red")## `geom_smooth()` using method = 'loess'
clim_datac %>%
filter(Year>2000) %>%
group_by(Year) %>%
summarise(Temperature = mean(AverageTemperature)) ->clim_data2qplot(Year, Temperature, data=clim_data2, main="Missouri Average Temperature \n 2000-Present",geom=c("point","smooth"))+ aes(colour = Temperature) + scale_color_gradient(low="blue", high="red")## `geom_smooth()` using method = 'loess'
This is the most revealing of all plots, highlighting how from year 2000 onwards, the temperatures have begun rising dangerously.
Conclusion: The data never lies! How can anybody deny global warming??