The thought process is now to check for anomalies. Picking countries to identify if there were any unusual temperature changes specific to where they may be located across the globe.
countries_of_interest <- c("USA", "RUS", "VNM", "BRA", "AUS", "SWE", "KEN")
filtered_data <- data %>%
filter(Code %in% countries_of_interest)
# Calculate the average annual mean temperature
country_yearly_avg <- filtered_data %>%
group_by(Year, Country) %>%
summarise(Average_Temperature = mean(Annual.Mean, na.rm = TRUE),
.groups = 'drop')
# Plot the temperature trends
b = ggplot(country_yearly_avg, aes(x = Year, y = Average_Temperature,
color = Country)) +
geom_line() +
labs(title = "Comparison of Average Annual Mean Temperature",
x = "Year",
y = "Temperature (°C)") +
theme_minimal() +
scale_color_brewer(palette = "Dark2") # palette