Description Usage Format Details References Examples
A dataset containing weather data for 2015-2017 for Montgomery County. Data
scraped from https://www.wunderground.com/history/airport/KGAI. This
data can be joined with the traffic_violations
data. Note that 61 daya
were missing from the scraped data for the 3 year period.
1 |
A data frame with 1,035 rows and 3 variables
date. The date.
temperature. The average temperature in fahrenheit (F).
precipitation. The inches of precipitation
https://www.wunderground.com/history/airport/KGAI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## Not run:
library(exampledata)
library(tidyverse)
library(lubridate)
traffic_violations %>%
count(`Date Of Stop`) %>%
mutate(`Date Of Stop` = lubridate::mdy(`Date Of Stop`)) %>%
left_join(weather_data, by = c(`Date Of Stop` = 'date')) %>%
arrange(`Date Of Stop`) %>%
dplyr::filter(temperature > 35) %>%
ggplot(aes(precipitation, n)) +
geom_jitter(alpha = .25) +
coord_cartesian(xlim = c(0, 2.5), ylim = c(0, 1300)) +
geom_smooth(fill = NA, method = 'loess')
traffic_violations %>%
count(`Date Of Stop`) %>%
mutate(`Date Of Stop` = lubridate::mdy(`Date Of Stop`)) %>%
left_join(weather_data, by = c(`Date Of Stop` = 'date')) %>%
arrange(`Date Of Stop`) %>%
mutate(precipitation2 = cut(precipitation, 3, breaks = c(-Inf, 0, .15, Inf), labels = c('no', 'low', 'high'))) %>%
ggplot(aes(temperature, n, color = precipitation2)) +
geom_jitter() +
geom_smooth(fill = NA) +
facet_wrap(~precipitation2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.