Temp <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/data%20-%20data.csv')
glimpse(Temp)
## Rows: 36
## Columns: 2
## $ Year <int> 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 19…
## $ Anomaly <dbl> 0.20, 0.33, 0.19, 0.16, 0.23, 0.36, 0.37, 0.31, 0.45, 0.42, 0.…
I will change the column name to Change.In.Temp for ease of reading
Temp <- subset(Temp, Year < 1983 | Year > 1992)
colnames(Temp)[2] <- "Change.In.Temp"
Temp
## Year Change.In.Temp
## 11 1993 0.23
## 12 1994 0.26
## 13 1995 0.35
## 14 1996 0.46
## 15 1997 0.35
## 16 1998 0.51
## 17 1999 0.62
## 18 2000 0.40
## 19 2001 0.42
## 20 2002 0.57
## 21 2003 0.62
## 22 2004 0.62
## 23 2005 0.57
## 24 2006 0.68
## 25 2007 0.68
## 26 2008 0.59
## 27 2009 0.58
## 28 2010 0.68
## 29 2011 0.72
## 30 2012 0.61
## 31 2013 0.67
## 32 2014 0.69
## 33 2015 0.76
## 34 2016 0.95
## 35 2017 1.02
## 36 2018 0.92
Temp$Change.In.Temp <- celsius.to.fahrenheit(Temp$Change.In.Temp)
Temp
## Year Change.In.Temp
## 11 1993 32.41
## 12 1994 32.47
## 13 1995 32.63
## 14 1996 32.83
## 15 1997 32.63
## 16 1998 32.92
## 17 1999 33.12
## 18 2000 32.72
## 19 2001 32.76
## 20 2002 33.03
## 21 2003 33.12
## 22 2004 33.12
## 23 2005 33.03
## 24 2006 33.22
## 25 2007 33.22
## 26 2008 33.06
## 27 2009 33.04
## 28 2010 33.22
## 29 2011 33.30
## 30 2012 33.10
## 31 2013 33.21
## 32 2014 33.24
## 33 2015 33.37
## 34 2016 33.71
## 35 2017 33.84
## 36 2018 33.66
p <- ggplot(Temp, aes(Year, Change.In.Temp, fill = Year)) +
geom_bar(stat = "identity") +
ggtitle("Bar Chart with changed factor levels")
ggplotly(p)
p <- Temp %>%
ggplot(aes(x = Year, y = Change.In.Temp)) +
geom_line(color = palette_light()[[1]]) +
scale_y_continuous() +
geom_smooth(method = "lm") +
labs(title = "Trend in Global Temperature Over Time",
subtitle = "Continuous Scale",
y = "Change in Temperature(in Farenheit)", x = "Year") +
theme_tq()
ggplotly(p)
## `geom_smooth()` using formula = 'y ~ x'
From https://www.epa.gov/climate-indicators/climate-change-indicators-tropical-cyclone-activity
HurNum<-read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/Num.of.hurricanes.csv')
HurInt<-read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/cyclone.ace.index.csv')
HurNum <- subset(HurNum, Year < 1880 | Year > 1992)
HurNum
## Year Total.hurricanes..adjusted. Total.hurricanes..unadjusted.
## 114 1993 5.2 5.2
## 115 1994 6.2 6.2
## 116 1995 6.0 6.0
## 117 1996 7.2 7.2
## 118 1997 8.2 8.2
## 119 1998 7.6 7.6
## 120 1999 7.6 7.6
## 121 2000 7.8 7.8
## 122 2001 7.2 7.2
## 123 2002 7.4 7.4
## 124 2003 8.8 8.8
## 125 2004 8.0 8.0
## 126 2005 8.4 8.4
## 127 2006 8.6 8.6
## 128 2007 7.4 7.4
## 129 2008 6.8 6.8
## 130 2009 7.2 7.2
## 131 2010 8.0 8.0
## 132 2011 6.8 6.8
## 133 2012 7.4 7.4
## 134 2013 5.8 5.8
## 135 2014 5.8 5.8
## 136 2015 5.8 5.8
## 137 2016 7.0 7.0
## 138 2017 7.0 7.0
## 139 2018 8.8 8.8
## Hurricanes.reaching.the.United.States
## 114 1.0
## 115 1.2
## 116 1.2
## 117 1.6
## 118 2.2
## 119 1.8
## 120 1.4
## 121 1.4
## 122 1.2
## 123 1.8
## 124 3.0
## 125 3.0
## 126 3.0
## 127 3.2
## 128 2.0
## 129 0.8
## 130 1.0
## 131 1.2
## 132 0.6
## 133 0.8
## 134 0.8
## 135 1.0
## 136 1.2
## 137 1.6
## 138 1.8
## 139 3.0
HurInt <- subset(HurInt, (Year < 1950 | Year > 1992) & !(Year %in% c(2019, 2020)))
HurInt
## Year Adjusted.ACE.Index..as...of.1981.2010.median.
## 44 1993 42.16216
## 45 1994 34.59459
## 46 1995 246.48649
## 47 1996 179.45946
## 48 1997 44.32432
## 49 1998 196.75676
## 50 1999 191.35135
## 51 2000 128.64865
## 52 2001 118.91892
## 53 2002 72.43243
## 54 2003 190.27027
## 55 2004 245.40541
## 56 2005 270.27027
## 57 2006 85.40541
## 58 2007 80.00000
## 59 2008 157.83784
## 60 2009 57.29730
## 61 2010 178.37838
## 62 2011 136.21622
## 63 2012 139.45946
## 64 2013 38.91892
## 65 2014 72.43243
## 66 2015 68.10811
## 67 2016 152.43243
## 68 2017 241.08108
## 69 2018 144.86486
merged_data <- merge(Temp, HurInt, by = "Year", all = TRUE)
merged_data <- merge(merged_data, HurNum, by = "Year", all = TRUE)
head(merged_data)
## Year Change.In.Temp Adjusted.ACE.Index..as...of.1981.2010.median.
## 1 1993 32.41 42.16216
## 2 1994 32.47 34.59459
## 3 1995 32.63 246.48649
## 4 1996 32.83 179.45946
## 5 1997 32.63 44.32432
## 6 1998 32.92 196.75676
## Total.hurricanes..adjusted. Total.hurricanes..unadjusted.
## 1 5.2 5.2
## 2 6.2 6.2
## 3 6.0 6.0
## 4 7.2 7.2
## 5 8.2 8.2
## 6 7.6 7.6
## Hurricanes.reaching.the.United.States
## 1 1.0
## 2 1.2
## 3 1.2
## 4 1.6
## 5 2.2
## 6 1.8
p <- merged_data %>%
ggplot(aes(x = Year, y = Total.hurricanes..adjusted.)) +
geom_line(color = palette_light()[[1]]) +
scale_y_continuous() +
labs(title = "Trend of Hurricane occurences",
subtitle = "Continuous Scale",
y = "Number of Hurricane occurences", x = "Year") +
theme_tq()
ggplotly(p)
There doesn’t seem to be a linear trend in the amount of hurricanes over time like there is with the increase in global temperature, but notice how in the years where there is a trough(the point before a rapid spike) in global temperature like 1997, 2005 or 2017, there was also spikes in the amount of hurricane occurrences
p <- merged_data %>%
ggplot(aes(x = Year, y = Adjusted.ACE.Index..as...of.1981.2010.median.)) +
geom_line(color = palette_light()[[1]]) +
scale_y_continuous() +
labs(title = "Trend of Hurricane occurences",
subtitle = "Continuous Scale",
y = "Number of Hurricane occurences", x = "Year") +
theme_tq()
ggplotly(p)
Again, here doesn’t seem to be a linear trend in the strength of hurricanes over time like there is with the increase in global temperature, but notice how in the years where there is a trough(the point before a rapid spike) in global temperature like 1997, 2005 or 2017, there was also spikes in the median strength of hurricanes
correlation_matrix <- cor(merged_data[c("Adjusted.ACE.Index..as...of.1981.2010.median.", "Total.hurricanes..adjusted.", "Change.In.Temp")])
correlation_df <- datatable(correlation_matrix)
correlation_df
ggpairs(merged_data[c("Adjusted.ACE.Index..as...of.1981.2010.median.", "Total.hurricanes..adjusted.", "Change.In.Temp")])
Conclusion Diagonal (Always 1): Each variable’s correlation with itself is always 1, indicating perfect correlation. Adjusted ACE Index vs. Total Hurricanes (0.386): Moderate positive correlation suggests that more intense hurricanes may lead to more hurricanes overall, but the relationship isn’t very strong. Adjusted ACE Index vs. Change in Temp (0.246): Weak positive correlation indicates that as intense hurricanes increase, there might be a slight increase in temperature, but the relationship isn’t very strong. Total Hurricanes vs. Change in Temp (0.219): Weak positive correlation suggests that as the total number of hurricanes rises, there might be a slight increase in temperature, but the connection isn’t very strong. Overall, these correlations suggest some links between hurricane intensity, the number of hurricanes, and changes in temperature, but other factors may also play a role.