{"id":22966626,"url":"https://github.com/favstats/lawrence_ma_fire","last_synced_at":"2026-01-15T22:37:04.121Z","repository":{"id":108350883,"uuid":"149528136","full_name":"favstats/lawrence_MA_fire","owner":"favstats","description":"Visualizing the Lawrence, MA Gas Explosion incident","archived":false,"fork":false,"pushed_at":"2018-09-22T15:34:50.000Z","size":5005,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-07T19:36:12.106Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/favstats.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-20T00:24:36.000Z","updated_at":"2019-04-12T13:51:47.000Z","dependencies_parsed_at":"2023-03-13T14:27:43.991Z","dependency_job_id":null,"html_url":"https://github.com/favstats/lawrence_MA_fire","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Flawrence_MA_fire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Flawrence_MA_fire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Flawrence_MA_fire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Flawrence_MA_fire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/favstats","download_url":"https://codeload.github.com/favstats/lawrence_MA_fire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246758372,"owners_count":20828919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T20:44:52.986Z","updated_at":"2026-01-15T22:37:04.116Z","avatar_url":"https://github.com/favstats.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"Gas Explosions in Lawrence, MA\n================\nFabio Votta\n22 9 2018\n\nYesterday, my good friend Ben tagged me in a tweet.\n\n![](images/start_tweet.png)\n\nAnd so an idea was born.\n\nData: \u003chttp://www.lawpd.com/DocumentCenter/View/3672/09-13-2018\u003e\n\n## Packages and Folders\n\n``` r\n# Install these packages if you don't have theme yet\n# devtools::install_github(\"dkahle/ggmap\", ref = \"tidyup\")\n# install.packages(\"pacman\")\n\npacman::p_load(tidyverse, pdftools, ggmap, gganimate)\n```\n\n## Load Data\n\n``` r\nfiredata \u003c- tidytemplate::load_it(\"data/firedata.Rdata\")\n```\n\n## Static Map\n\n``` r\nlawrence \u003c- c(left = -71.19, bottom = 42.68, right = -71.13, top = 42.72)\nmap \u003c- get_stamenmap(lawrence, zoom = 14, maptype = \"toner-lite\")\n\n\nfirstmap \u003c- ggmap(map) + # creates the map\n  geom_point(aes(x = lon, y = lat, \n                 color = fire, shape = fire),                       # adding your data\n             size = 2,\n             data = firedata) +\n  scale_shape_manual(\"Type\", values= c(17, 4))+\n  ggthemes::theme_map() +\n  scale_colour_manual(\"Type\", values = ggthemes::gdocs_pal()(2) %\u003e% rev()) +\n  labs(title = \"911 Calls on 13th September 2018 in Lawrence, Massachusetts\",\n      caption = \"Data Source: LAWPD\\nFire Incidents: 84 out of 196 Total Incidents\\n@FabioFavusMaxim; favstats.eu\")  +\n  theme(plot.title = element_text(size = 13, face = \"bold\"), \n    plot.caption = element_text(size = 8))\n  \ntidytemplate::ggsave_it(firstmap, width = 6, height = 6)\n```\n\n[![](images/firstmap.png)](images/firstmap.png)\n\n## Animated\n\n``` r\nfiredata \u003c- firedata %\u003e% \n  mutate(fire = ifelse(fire, \"Fire\", \"Other\"))\n\nfiredata \u003c- firedata %\u003e%\n  distinct(lon, lat, .keep_all = T)\n\nfire_anim \u003c- ggmap(map) + # creates the map\n  geom_point(aes(x = lon, y = lat, group = id,\n                 color = fire, shape = fire),                       # adding your data\n             size = 3,\n             data = firedata %\u003e% \n               filter(fire == \"Fire\")) +\n  scale_shape_manual(\"Report Type\", values= c(17, 4))+\n  ggthemes::theme_map() +\n  scale_colour_manual(\"Report Type\", values = ggthemes::gdocs_pal()(2) %\u003e% rev()) +\n  labs(title = \"911 Calls on 13th September 2018 in Lawrence, Massachusetts\",\n      subtitle = \"Time: {closest_state}\",\n      caption = \"Data Source: LAWPD\\nFire Incidents: 84 out of 196 Total Incidents\\n@FabioFavusMaxim; favstats.eu\")  +\n  theme(plot.title = element_text(size = 13, face = \"bold\"),\n    plot.subtitle = element_text(size = 13, face = \"bold\"), \n    plot.caption = element_text(size = 10))  +  \n  # geom_text(data = firedata,\n            # aes(label = time, y = 42.719, x = -71.179), size = 6) +\n  transition_states(datetime, 1, 1, wrap = T) +\n  shadow_mark()\n\n\nfire_anim %\u003e% animate(\n  nframes = 500, fps = 10, width = 550, height = 550, detail = 1\n)\n\nanim_save(\"images/fire_anim.gif\")\n```\n\n[![](images/fire_anim.gif)](images/fire_anim.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffavstats%2Flawrence_ma_fire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffavstats%2Flawrence_ma_fire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffavstats%2Flawrence_ma_fire/lists"}