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("https://data.oregon.gov/resource/8kyv-b2kw.csv")
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(.
The Office
library(tidyverse)
office_ratings <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-17/office_ratings.csv')
A First Plot
The number of episodes for the Office by season.
library(janitor)
TableS <- office_ratings %>% tabyl(season)
p1 <- TableS %>% ggplot(., aes(x=as.factor(season), y=n, fill=as.factor(season))) + geom_col() + labs(x="Season", y="Episodes", title="The Office: Episodes") + guides(fill=FALSE)
p1
Ratings
How are the various seasons and episodes rated?
p2 <- office_ratings %>% ggplot(., aes(x=as.factor(season), y=imdb_rating, fill=as.factor(season), color=as.factor(season))) + geom_violin(alpha=0.3) + guides(fill=FALSE, color=FALSE) + labs(x="Season", y="IMDB Rating") + geom_point()
p2
Patchwork
Using patchwork, we can combine multiple plots.