Skip to content

Instantly share code, notes, and snippets.

@idshklein
Created September 27, 2023 19:25
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 idshklein/c1521c8631aa08fd2533b163156cf78c to your computer and use it in GitHub Desktop.
Save idshklein/c1521c8631aa08fd2533b163156cf78c to your computer and use it in GitHub Desktop.
pacman::p_load(tidyverse,jsonlite,lubridate)
js <-
read_json("https://data.gov.il/api/3/action/datastore_search?resource_id=e265857e-9f53-419f-ad0b-860d2bf6fbb8&filters={%22StationId%22:[%2217112%22,%2217111%22,%2217113%22,%2217110%22]}&limit=100000")
js$result$records %>%
map_df(~.x) %>%
gather(day,count,starts_with("day_")) %>%
mutate(day = str_remove(day,"day_")) %>%
mutate(date = ymd(paste(year_key,month_key,day,sep = "/")),.keep = "unused") %>%
mutate(count = coalesce(as.numeric(count),0)) %>%
filter(!is.na(date)) %>%
ggplot(aes(x=date,y=count,color = LowOrPeakDescFull)) +
geom_line()+
facet_wrap(~StationName )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment