#Develop four questions or ideas about climate change from your visualizations.

#Identify what information interests you about climate change.

This analysis is intested in “What is warming our earth?” According to NASA Goddard Institute for Space Studies, the earth has been warming up each year. Global warming was evident in the 1940s and escalated even more starting in the 1970s.

The first dataset is from NASA GISS database that is a Combined Land-Surface Air and Sea-Surface Water Temperature Anomalies (Land-Ocean Temperature Index, L-OTI). The second dataset is from Bloomberg which shows information regarding natural and human causes of climate change. By comparing the temperature anomalies from the year 1880 to 2005 and contrast them with another data set providing information on natural and human causes of climate change to make it plainly visible what is causing the increase in temperature of our earth. Once the source is identified further research can be conducted and climate policies can be made to ensure we take steps to protect our environment.

#Find, collect, organize, and summarize the data necessary to create your data exploration plan.

data = read.csv('/Users/mo_more/2021 HU506 analytics/final-/global_temperature_anomalies.csv')
data.forcings = read.csv('/Users/mo_more/2021 HU506 analytics/final-/forcings.csv')
summary(data)
##   hemisphere             year           jan                feb          
##  Length:423         Min.   :1880   Min.   :-1.52000   Min.   :-0.97000  
##  Class :character   1st Qu.:1915   1st Qu.:-0.24000   1st Qu.:-0.23000  
##  Mode  :character   Median :1950   Median :-0.03000   Median :-0.04000  
##                     Mean   :1950   Mean   : 0.04929   Mean   : 0.05643  
##                     3rd Qu.:1985   3rd Qu.: 0.30500   3rd Qu.: 0.36000  
##                     Max.   :2020   Max.   : 1.60000   Max.   : 1.95000  
##                                                                         
##       mar             apr                may                jun          
##  Min.   :-0.78   Min.   :-0.64000   Min.   :-0.72000   Min.   :-0.65000  
##  1st Qu.:-0.22   1st Qu.:-0.25000   1st Qu.:-0.24000   1st Qu.:-0.26000  
##  Median :-0.02   Median :-0.03000   Median :-0.04000   Median :-0.05000  
##  Mean   : 0.07   Mean   : 0.04875   Mean   : 0.03913   Mean   : 0.02513  
##  3rd Qu.: 0.32   3rd Qu.: 0.28000   3rd Qu.: 0.24000   3rd Qu.: 0.23000  
##  Max.   : 1.91   Max.   : 1.49000   Max.   : 1.28000   Max.   : 1.20000  
##                                                                          
##       jul                aug                sep                oct          
##  Min.   :-0.58000   Min.   :-0.76000   Min.   :-0.79000   Min.   :-0.83000  
##  1st Qu.:-0.20000   1st Qu.:-0.21000   1st Qu.:-0.21000   1st Qu.:-0.20500  
##  Median :-0.03000   Median :-0.05000   Median :-0.04000   Median : 0.00000  
##  Mean   : 0.04799   Mean   : 0.04648   Mean   : 0.04924   Mean   : 0.07463  
##  3rd Qu.: 0.23500   3rd Qu.: 0.26000   3rd Qu.: 0.25000   3rd Qu.: 0.27500  
##  Max.   : 1.11000   Max.   : 1.14000   Max.   : 1.23000   Max.   : 1.32000  
##                                                                             
##       nov                dec                j_d                d_n          
##  Min.   :-0.82000   Min.   :-1.13000   Min.   :-0.57000   Min.   :-0.57000  
##  1st Qu.:-0.20000   1st Qu.:-0.22000   1st Qu.:-0.21000   1st Qu.:-0.21000  
##  Median : 0.01000   Median :-0.04000   Median :-0.03000   Median :-0.04500  
##  Mean   : 0.07113   Mean   : 0.04423   Mean   : 0.05184   Mean   : 0.05293  
##  3rd Qu.: 0.27000   3rd Qu.: 0.29500   3rd Qu.: 0.25500   3rd Qu.: 0.27000  
##  Max.   : 1.62000   Max.   : 1.54000   Max.   : 1.36000   Max.   : 1.38000  
##                                                           NA's   :3         
##       djf                mam                jja                son          
##  Min.   :-1.05000   Min.   :-0.70000   Min.   :-0.52000   Min.   :-0.71000  
##  1st Qu.:-0.22000   1st Qu.:-0.24000   1st Qu.:-0.22000   1st Qu.:-0.19500  
##  Median :-0.04000   Median :-0.05000   Median :-0.05000   Median :-0.02000  
##  Mean   : 0.04955   Mean   : 0.05277   Mean   : 0.03991   Mean   : 0.06511  
##  3rd Qu.: 0.29250   3rd Qu.: 0.27500   3rd Qu.: 0.22000   3rd Qu.: 0.26000  
##  Max.   : 1.68000   Max.   : 1.51000   Max.   : 1.13000   Max.   : 1.35000  
##  NA's   :3
summary(data.forcings)
##       Year       All.forcings       Human          Natural     
##  Min.   :1850   Min.   :287.1   Min.   :287.4   Min.   :287.1  
##  1st Qu.:1889   1st Qu.:287.5   1st Qu.:287.5   1st Qu.:287.4  
##  Median :1928   Median :287.6   Median :287.6   Median :287.5  
##  Mean   :1928   Mean   :287.7   Mean   :287.7   Mean   :287.4  
##  3rd Qu.:1966   3rd Qu.:287.8   3rd Qu.:287.7   3rd Qu.:287.5  
##  Max.   :2005   Max.   :288.4   Max.   :288.3   Max.   :287.6  
##  Anthropogenic.tropospheric.aerosol Greenhouse.gases    Land.use    
##  Min.   :287.0                      Min.   :287.4    Min.   :287.3  
##  1st Qu.:287.2                      1st Qu.:287.5    1st Qu.:287.4  
##  Median :287.4                      Median :287.7    Median :287.4  
##  Mean   :287.3                      Mean   :287.8    Mean   :287.4  
##  3rd Qu.:287.4                      3rd Qu.:287.9    3rd Qu.:287.5  
##  Max.   :287.5                      Max.   :288.7    Max.   :287.5  
##  Orbital.changes     Ozone           Solar          Volcanic    
##  Min.   :287.4   Min.   :287.4   Min.   :287.4   Min.   :287.1  
##  1st Qu.:287.4   1st Qu.:287.4   1st Qu.:287.4   1st Qu.:287.4  
##  Median :287.4   Median :287.5   Median :287.5   Median :287.5  
##  Mean   :287.4   Mean   :287.5   Mean   :287.5   Mean   :287.4  
##  3rd Qu.:287.5   3rd Qu.:287.5   3rd Qu.:287.5   3rd Qu.:287.5  
##  Max.   :287.5   Max.   :287.6   Max.   :287.6   Max.   :287.6

#Design and create the most appropriate visualizations (no less than 5 visualizations) to explore the data and present that information. #Finally organize the layout of those visualizations into a dashboard (use the flexdashboard package) in a way that shows your path of data exploration.

Data visualizaiton1 :

From the fisrt climate change dataset from 1880 to 2020, which covers global temperature changes throughout the year. It is ovious that the global watming is true.

ggplot(data, aes(x=year, y=jan)) + 
  geom_line(color="Light Blue") + 
  geom_point(size=0.3, colour=" Dark blue") +
  geom_hline(yintercept = mean(data$jan), color="blue") +
  labs(y="January temperature", 
       x="Year", 
       title="Temperature in January since 1880")+ 
       theme_gray()+ # Default theme 
        theme(plot.title = element_text(size=22),axis.text.x= element_text(size=15),
                            axis.text.y= element_text(size=15), axis.title=element_text(size=18))

Data visualizaiton2:

I analyzed the trends and causes of climate warming by detecting global climate change data from 1880 to 2020, which covers global temperature changes throughout the year. Human factors (combined) has more closer trend as the sphere temperature, comparet to the natural factor (combined).

g = ggplot(data.forcings, aes(x=Year, y=Human))
g + geom_line(color="dark red") +
    geom_point(size=0.5, colour="orange") +
    labs(title = "Temparature changes over years by Human forcings",
         x = "Year from 1880 to 2005",
         y = "Huamn forcings") + 
    theme(title=element_text(size=14))

g2 = ggplot(data.forcings, aes(x=Year, y=Natural))
g2 + geom_line(colour="dark green") +
    geom_point(size=0.5, color="green") + 
    labs(title = "Temparature changes over years by Natural forcings",
         x = "Year from 1880 to 2005",
         y = "Natural forcings") + 
    theme(title=element_text(size=14))

Data visualizaiton3 :

As human factors combined are more likely to be the cause of global warming, I want to break down which factor, or how many factors should be responsible for it. Among for factors from the dataser, aerosoll, land use, greenhouse gasem ozone, and based on the charts for each, we can conclude that the Greenhouse Gases Temperature line has the closest pattern as the earth’s temperature increasing trend.

g3 = ggplot(data.forcings, aes(x=Year, y=Anthropogenic.tropospheric.aerosol))
g3 + geom_line(color="orange") +
    geom_point(size=1, colour="orange") +
    geom_smooth(se =FALSE, method = lm) + 
    labs(title = "Temparature changes over years by Aerosoll",
         x = "Year from 1880 to 2005",
         y = "Aerosol") + 
    theme(title=element_text(size=14))
## `geom_smooth()` using formula 'y ~ x'

g4 = ggplot(data.forcings, aes(x=Year, y=Greenhouse.gases))
g4 + geom_line(colour="orange") +
    geom_point(size=1, color="orange") +
    geom_smooth(se =FALSE, method = lm) + 
    labs(title = "Temparature changes over years by Greenhouse Gases",
         x = "Year from 1880 to 2005",
         y = "Greenhouse Gases") + 
    theme(title=element_text(size=14))
## `geom_smooth()` using formula 'y ~ x'

g5 = ggplot(data.forcings, aes(x=Year, y= Land.use))
g5 + geom_line(colour="orange") +
    geom_point(size=1, color="orange") +
    geom_smooth(se =FALSE, method = lm) + 
    labs(title = "Temparature changes over years by Land.use",
         x = "Year from 1880 to 2005",
         y = " Land.use") + 
    theme(title=element_text(size=14))
## `geom_smooth()` using formula 'y ~ x'

g6 = ggplot(data.forcings, aes(x=Year, y=Ozone))
g6 + geom_line(colour="orange") +
    geom_point(size=1, color="orange") +
    geom_smooth(se =FALSE, method = lm) + 
    labs(title = "Temparature changes over years by Ozone",
         x = "Year from 1880 to 2005",
         y = "Ozone ") + 
    theme(title=element_text(size=14))
## `geom_smooth()` using formula 'y ~ x'