Created
March 8, 2019 20:13
-
-
Save JohannesFriedrich/e9253e3feda69f9ea41d85a6dbbf4d3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(hystReet) | |
## Get locations | |
locations <- get_hystreet_locations() | |
Duesseldorf <- locations %>% | |
filter(city == "Düsseldorf") | |
data <- lapply(Duesseldorf$id, function(x){ | |
temp <- get_hystreet_station_data( | |
hystreetId = x, | |
query = list(from = "01-01-2019", to = "07-03-2019", resolution = "day")) | |
name <- temp$name | |
temp <- temp$measurements | |
temp$name = name | |
return(temp) | |
}) %>% map_df(~.x) | |
## Prepare data | |
data %<>% | |
mutate(weekday = weekdays(timestamp)) %>% | |
filter(weekday %in% c("Thursday")) | |
## Plot | |
ggplot(data) + | |
geom_bar(aes(x = timestamp, y = pedestrians_count, fill = name), stat = "identity", position = "dodge") + | |
labs(x = "Date", | |
y = "Pedestrians", | |
fill = "Street") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment