COVID-19 Maps for Oregon

library(tigris) library(rgdal) library(htmltools) library(viridis) library(sf) library(ggrepel) library(ggthemes) library(gganimate) library(patchwork) library(hrbrthemes) load(url(paste0("",Sys.Date(),".RData"))) Verifying, these data are current as of 2020-12-01 according to the loaded dataset. A base map To build a map to work from, I need a map library. Load the tigris library then grab the map as an sf object; there is a geom_sf that makes them easy to work with. Finally, I join the map to the data.

Non-Profits in Oregon: Socrata is Cool

Socrata: The Open Data Portal I did not previously know much about precisely how open data portals had evolved. Oregon’s is quite nice and I will take the opportunity to map and summarise non-profits throughout the state. Here is the data. library(RSocrata) Oregon.Nonprofits <- read.socrata("") glimpse(Oregon.Nonprofits) ## Rows: 163,489 ## Columns: 18 ## $ registry_number <int> 299818, 299818, 299818, 299818, 299818, 5… ## $ business_name <chr> "UNITED METHODIST CHURCH, OREGON CITY, OR… ## $ entity_type <chr> "DOMESTIC NONPROFIT CORPORATION", "DOMEST… ## $ registry_date <chr> "1850-05-17 00:00:00", "1850-05-17 00:00:… ## $ nonprofit_type <chr> "RELIGIOUS WITH MEMBERS", "RELIGIOUS WITH… ## $ associated_name_type <chr> "MAILING ADDRESS", "PRESIDENT", "PRINCIPA… ## $ first_name <chr> "", "MIKE", "", "MIKE", "CHRISTA", "", "S… ## $ middle_name <chr> "", "", "", "", "", "", "E", "", "", "", … ## $ last_name <chr> "", "BENISCHEK", "", "BENISCHEK", "PALMER… ## $ suffix <chr> "", "", "", "", "", "", "", "", "", "", "… ## $ not_of_record_entity <chr> "", "", "", "", "", "", "", "", "", "", "… ## $ entity_of_record_reg_number <int> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N… ## $ entity_of_record_name <chr> "", "", "", "", "", "", "", "", "", "", "… ## $ address <chr> "18955 S SOUTH END RD", "18955 S SOUTH EN… ## $ address_continued <chr> "", "", "", "", "", "", "", "", "", "", "… ## $ city <chr> "OREGON CITY", "OREGON CITY", "OREGON CIT… ## $ state <chr> "OR", "OR", "OR", "OR", "OR", "OR", "OR",… ## $ zip_code <chr> "97045", "97045", "97045", "97045", "9704… A basic zip code map or_zips <- zctas(cb = TRUE, starts_with = "97", class="sf") or_zips %>% ggplot(.

A GeoFacet of Credit Quality

In previous work with Skip Krueger, we conceptualized bond ratings as a multiple rater problem and extracted measure of state level creditworthiness. I had always had it on my list to do something like this and recently ran across a package called geofacet that makes it simply to easy to do. So here goes. The code is below the post. library(haven) library(dplyr) Pew.Data <- read_dta(url("")) library(tidyverse) load(url("")) state.ratings <- data.

Mapping COVID-19 in Oregon

Oregon COVID data The Oregon data are available from OHA here. I cut and pasted the first two days because it was easy with datapasta. As it goes on, it was easier to write a script that I detail elsewhere that I can self-update. urbnmapr The Urban Institute has an excellent state and county mapping package. I want to make use of the county-level data and plot the starter map.

Tracking COVID-19 2020-03-24

R to Import COVID Data library(tidyverse) library(gganimate) COVID.states <- read.csv(url("")) COVID.states <- COVID.states %>% mutate(Date = as.Date(as.character(date), format = "%Y%m%d")) The Raw Testing Incidence I want to use patchwork to show the testing rate by state in the United States. Then I want to show where things currently stand. In both cases, a base-10 log is used on the number of tests.

R for Driving Directions?

Driving Directions from R There is no reason that maps with driving directions cannot be produced in R. Given the directions api from Google, it should be doable. As it happens, I was surprised how easy it was. Let me try to map a simple A to B location. First, to the locations; I will specify two. It is possible to geolocate addresses for this also, I happened to have the GPS coordinates in hand.

The Carbon Footprint of Food Produced for Consumption

tidyTuesday on the Carbon Footprint of Feeding the Planet The tidyTuesday for this week relies on data scraped from the Food and Agricultural Organization of the United Nations. The blog post for obtaining the data can be found on r-tastic. The scraping exercise is nice and easy to follow and explored a case of cleaning up a very messy data structure. I took this exercise as practice for using pivot_wider and pivot_longer.

Mapping San Francisco Trees

Trees in San Francisco This week’s data cover trees in San Francisco. sf_trees <- readr::read_csv('') library(tidyverse); library(ggmap); library(skimr) skim(sf_trees) Table 1: Data summary Name sf_trees Number of rows 192987 Number of columns 12 _______________________ Column type frequency: character 6 Date 1 numeric 5 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_unique whitespace legal_status 54 1.

Simple Point Maps in R

Mapping Points in R My goal is a streamlined and self-contained freeware map maker with points denoting addresses. It is a three step process that involves: Get a map. Geocode the addresses into latitude and longitude. Combine the the two with a first map layer and a second layer on top that contains the points. From there, it is pretty easy to get fancy using ggplotly to put relevant text hovers into place.

Dog Movements: a tidyTuesday

Adoptable Dogs # devtools::install_github("thebioengineer/tidytuesdayR", force=TRUE) tuesdata51 <- tidytuesdayR::tt_load(2019, week = 51) dog_moves <- tuesdata51$dog_moves dog_des <- readr::read_csv('') library(tidyverse); library(scatterpie) library(rgeos) library(maptools) library(rgdal); library(usmap); library(ggthemes) The Base Map My.Map <- us_map(regions = "states") Base.Plot <- ggplot() + geom_polygon(data=My.Map, aes(x=x, y=y, group=group), fill="white", color="black") + theme_map() Base.Plot A fifty state map to plot this information on. New.Dat <- left_join(My.Map, dog_moves, by= c("full" = "location")) ggplot() + geom_polygon(data=New.