Skip to content

Instantly share code, notes, and snippets.

@mdneuzerling
Last active June 14, 2019 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdneuzerling/f716cbbb4455896b90e23cc27fdc5e62 to your computer and use it in GitHub Desktop.
Save mdneuzerling/f716cbbb4455896b90e23cc27fdc5e62 to your computer and use it in GitHub Desktop.
library(tidyverse)
library(bomrang)
weather <- get_historical(
stationid = "090015",
type = "max"
)
weather %>%
filter(!is.na(Max_temperature)) %>% # remove missing values
mutate(
Season = case_when(
Month %in% c(12, 1, 2) ~ "Summer",
Month %in% c(3, 4, 5) ~ "Autumn",
Month %in% c(6, 7, 8) ~ "Winter",
Month %in% c(9, 10, 11) ~ "Spring"
),
Season = factor(Season, levels = c("Summer", "Autumn", "Winter", "Spring")) # ordering
) %>%
group_by(Year, Season) %>%
summarise(Average_max_temp = mean(Max_temperature)) %>%
ggplot(aes(x = Year, y = Average_max_temp)) +
geom_point() +
geom_smooth() +
facet_grid(Season ~ .) +
ggtitle("Cape Otway Lighthouse seasonal temperatures")
@mdneuzerling
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment