Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 14 commits into
base: feedback
Choose a base branch
from
Prev Previous commit
Next Next commit
Commit case study 12
andreaharder committed Dec 12, 2024
commit 5f169b4577593955d79f049a433f5d3e6b9f8097
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"))