Created
May 1, 2022 18:37
-
-
Save idshklein/1ca195291c32831cf7962614c3e6095d to your computer and use it in GitHub Desktop.
This file contains hidden or 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(jsonlite) | |
library(lubridate) | |
library(hms) | |
res3 <- map(0:25,function(x){ | |
print(x) | |
res2 <- read_json(paste0("https://open-bus-stride-api.hasadna.org.il/siri_rides/list?siri_route__line_refs=7005&order_by=siri_route_id%20asc%2Cvehicle_ref%20desc&offset=",x*100)) | |
df2 <- map_df(1:length(res2),~res2[[.x]]) | |
df2 | |
}) | |
res3 %>% | |
bind_rows() %>% | |
mutate(scheduled_start_time = as_datetime(scheduled_start_time,tz = "Israel"), | |
scheduled_start_time_hm = as_hms(scheduled_start_time), | |
wd = wday(scheduled_start_time)) %>% | |
ggplot(aes(x = scheduled_start_time_hm, y= duration_minutes)) + | |
geom_point() + | |
geom_smooth() | |
res3 %>% | |
bind_rows() %>% | |
mutate(scheduled_start_time = as_datetime(scheduled_start_time,tz = "Israel"), | |
scheduled_start_time_hm = as_hms(scheduled_start_time), | |
wd = wday(scheduled_start_time)) %>% | |
ggplot(aes(x = scheduled_start_time)) + | |
geom_histogram() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment