#Read in Files
library(readr)
usa <- read_csv("~/workspace/Analysis/USA.csv")
View(usa)
# usa has 600 observations and 5 variables


gbr <- read_csv("~/workspace/Analysis/GBR.csv")
View(gbr)
# GBR has 300 observations and 5 variables

#Add your code below each of the prompts below.

#----
#Perform Summary Analysis on Data

# descriptive statistics for USAs data
summary(usa)

# descriptive statistics for GBR data
summary(gbr)


#----
#For any 2 Data Columns, Perform Min/Max/Average Analysis for each data set and store in variable

# chosen columns: 1. Temparature 2. Rainfall

# min temparature for USA
usa_min_temp <- min(usa$`Temperature (C)`)
usa_min_temp

# max temp for USA
usa_max_temp <- max(usa$`Temperature (C)`)
usa_max_temp

# avarage temp for USA
usa_avg_temp <- mean(usa$`Temperature (C)`)
usa_avg_temp

# min rainfall for USA
usa_min_rainfall <- min(usa$`Rainfall (mm)`)
usa_min_rainfall

# max rainfall for USA
usa_max_rainfall <- max(usa$`Rainfall (mm)`)
usa_max_rainfall

# avarage rainfall for USA
usa_avg_rainfall <- mean(usa$`Rainfall (mm)`)
usa_avg_rainfall

# min temp for GBR
gbr_min_temp <- min(gbr$`Temperature (C)`)
gbr_min_temp

# max temp for GBR
gbr_max_temp <- max(gbr$`Temperature (C)`)
gbr_max_temp

# avarage temp for GBR
gbr_avg_temp <- mean(gbr$`Temperature (C)`)
gbr_avg_temp

# min rainfall for GBR
gbr_min_rainfall <- min(gbr$`Rainfall (mm)`)
gbr_min_rainfall

# max rainfall for GBR
gbr_max_rainfall <- max(gbr$`Rainfall (mm)`)
gbr_max_rainfall

# avarage rainfall for GBR
gbr_avg_rainfall <- mean(gbr$`Rainfall (mm)`)
gbr_avg_rainfall

#----
#Compare Dataset Values 

# min temp
gbr_min_temp > usa_min_temp
abs(gbr_min_temp - usa_min_temp)

# GBR has higher min temp compared to that of USA
# the difference is 6.6416


# max temp
usa_max_temp > gbr_max_temp
abs(usa_max_temp - gbr_max_temp)
# USA has higher max temp compared to that of GBR
# the difference is 4.0474

# average temp
gbr_avg_temp > usa_avg_temp
abs(gbr_avg_temp -usa_avg_temp)
# GBR has higher average temp compared to that of USA
# the difference is 1.600546

# min rainfall
usa_min_rainfall > gbr_min_rainfall 
abs(usa_min_rainfall - gbr_min_rainfall  )
# USA has higher min rainfall compared to that of GBR
# minimum rainfall  difference is  7.9765

# max rainfall
gbr_max_rainfall > usa_max_rainfall 
abs(gbr_max_rainfall - usa_max_rainfall)
# GBR has higher max rainfall compared to that of USA
# the difference is 147.9644

# average rainfall
gbr_avg_rainfall > usa_avg_rainfall
abs(gbr_avg_rainfall - usa_avg_rainfall)
# GBR has higher average rainfall compared to that of USA
# the difference is  47.89198
