Browse Source

2019-11-01

master
boB Rudis 5 years ago
parent
commit
eafce39a20
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 1
      .gitignore
  2. 91
      2019-11-01-points.Rmd
  3. 14
      README.Rmd
  4. 35
      README.md
  5. BIN
      data/2019-11-01-geocoded.rds

1
.gitignore

@ -7,3 +7,4 @@ README_cache
src/*.o
src/*.so
src/*.dll
.httr-oauth

91
2019-11-01-points.Rmd

@ -0,0 +1,91 @@
---
title: "Points"
author: "hrbrmstr"
date: "2019-11-01"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## School Ransomware Incidents
```{r}
library(googlesheets)
library(sf)
library(rgeocodio) # hrbrmstr/rgeocodio
library(albersusa) # hrbrmstr/albersusa
library(hrbrthemes) # hrbrmstr/hrbrthemes
library(tidyverse)
gs_auth()
gs_url("https://docs.google.com/spreadsheets/d/1p-_GRo4YPW7m4QnjvErKD4U67t8-O6aDBlRjy9V8g8Y/edit#gid=1925609334") %>%
gs_read() %>%
mutate(
year_public = ifelse(
year_public < 2000, lubridate::year(date_added), year_public
) %>% factor()
) %>%
select(year_public, city_st) -> xdf
if (!file.exists(here::here("data/2019-11-01-geocoded.rds"))) {
coded <- gio_batch_geocode(xdf$city_st)
saveRDS(coded, here::here("data/2019-11-01-geocoded.rds"))
}
coded <- readRDS(here::here("data/2019-11-01-geocoded.rds"))
bind_cols(
xdf,
select(coded, r = response_results, state) %>%
mutate(r = map(r, ~.x[1,])) %>%
unnest(r) %>%
select(state, lng = location.lng, lat = location.lat)
) %>%
filter(!is.na(lat), !is.na(lng)) -> xdf
outside <- filter(xdf, state %in% c("AK", "HI"))
bind_cols(
select(outside, year_public, state),
select(outside, lng, lat) %>%
points_elided() %>%
rename(lng = x, lat = y)
) %>%
bind_rows(
filter(xdf, !(state %in% c("AK", "HI"))) %>%
select(year_public, state, lng, lat)
) %>%
left_join(
count(., year_public)
) %>%
mutate(lab = glue::glue("{year_public} : {n} Tracked Incidents")) %>%
st_as_sf(coords = c("lng", "lat"), crs = us_longlat_proj) -> incidents
usa <- usa_sf("laea")
ggplot() +
geom_sf(
data = usa, fill = "#3B454A", size = 0.125, color = "#b2b2b277"
) +
geom_sf(
data = incidents, aes(fill = lab),
color = "white", size = 1.5, alpha = 2/3, shape = 21,
show.legend = FALSE
) +
ggthemes::scale_color_tableau() +
coord_sf(datum = NA) +
facet_wrap(~lab) +
labs(
title = "Locations of K-12 Ransomware Indidents 2016-2019 (Sept)",
caption = "https://git.rud.is/hrbrmstr/y2019-30daymapchallenge • #30DayMapChallenge"
) +
theme_ft_rc(grid="", strip_text_face = "bold") +
theme(axis.text = element_blank()) +
theme(strip.text = element_text(color = "white"))
```

14
README.Rmd

@ -1,7 +1,7 @@
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: inline
chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
knitr::opts_chunk$set(
@ -10,5 +10,15 @@ knitr::opts_chunk$set(
options(width=120)
```
# y2019-30daymapchallenge
# 30 Day Map Challenge
```{r echo=FALSE}
library(googlesheets)
library(tidyverse)
gs_auth()
gs_url("https://docs.google.com/spreadsheets/d/13LqOIQp17oEXx8R6vcJPDsvaII8nD9tJ_5DF9G7oZ18/edit#gid=0") %>%
gs_read() %>%
select(-Idea, -Data) %>%
knitr::kable('markdown')
```

35
README.md

@ -0,0 +1,35 @@
# 30 Day Map Challenge
| Date | Day | Topic |
| :--------- | :-------- | :---------------- |
| 2019-11-01 | Friday | Points |
| 2019-11-02 | Saturday | Lines |
| 2019-11-03 | Sunday | Polygons |
| 2019-11-04 | Monday | Hexagons |
| 2019-11-05 | Tuesday | Raster |
| 2019-11-06 | Wednesday | Blue |
| 2019-11-07 | Thursday | Red |
| 2019-11-08 | Friday | Green |
| 2019-11-09 | Saturday | Yellow |
| 2019-11-10 | Sunday | Black and White |
| 2019-11-11 | Monday | Elevation |
| 2019-11-12 | Tuesday | Movement |
| 2019-11-13 | Wednesday | Tracks |
| 2019-11-14 | Thursday | Boundaries |
| 2019-11-15 | Friday | Names |
| 2019-11-16 | Saturday | Places |
| 2019-11-17 | Sunday | Zones |
| 2019-11-18 | Monday | Globe |
| 2019-11-19 | Tuesday | Urban |
| 2019-11-20 | Wednesday | Rural |
| 2019-11-21 | Thursday | Environment |
| 2019-11-22 | Friday | Built Environment |
| 2019-11-23 | Saturday | Population |
| 2019-11-24 | Sunday | Statistics |
| 2019-11-25 | Monday | Climate |
| 2019-11-26 | Tuesday | Hydrology |
| 2019-11-27 | Wednesday | Resources |
| 2019-11-28 | Thursday | Funny |
| 2019-11-29 | Friday | Experimental |
| 2019-11-30 | Saturday | Home |

BIN
data/2019-11-01-geocoded.rds

Binary file not shown.
Loading…
Cancel
Save