Skip to content

Instantly share code, notes, and snippets.

@JohannesFriedrich
Created March 8, 2019 20:13
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 JohannesFriedrich/e9253e3feda69f9ea41d85a6dbbf4d3c to your computer and use it in GitHub Desktop.
Save JohannesFriedrich/e9253e3feda69f9ea41d85a6dbbf4d3c to your computer and use it in GitHub Desktop.
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