Skip to content

Commit

Permalink
Commit case study 12
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaharder committed Dec 12, 2024
1 parent 9b8ee8e commit 5f169b4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions week_12/CaseStudy12.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
library(tidyverse)
library(htmlwidgets)
library(widgetframe)
library(xts)
library(dygraphs)
library(openmeteo)

#Download weather data for Buffalo, NY
d<- weather_history(c(43.00923265935055, -78.78494250958327),start = "2023-01-01",end=today(),
daily=list("temperature_2m_max","temperature_2m_min","precipitation_sum")) %>%
mutate(daily_temperature_2m_mean=(daily_temperature_2m_max+daily_temperature_2m_min)/2)

#Order the variables
xts <- select(d, daily_temperature_2m_min,daily_temperature_2m_mean, daily_temperature_2m_max)%>%
xts(order.by=d$date)

Precip <- select(d, daily_precipitation_sum)%>%
xts(order.by=d$date)

#Make the graphs
dygraph(xts, main = "Daily Maximum Temperature in Buffalo, NY") %>%
dySeries("daily_temperature_2m_mean")%>%
dyRangeSelector(dateWindow = c("2023-01-01", "2024-10-31"))

dygraph(Precip, main = "Daily Precipitation in Buffalo, NY")%>%
dyRangeSelector(dateWindow = c("2023-01-01", "2024-10-31"))

0 comments on commit 5f169b4

Please sign in to comment.