November 9, 2022

Oregon County Support for Retaining Slavery in the OR Constitution

Last update: November 15. 2022 In preparation for the dumpster fire that is Oregon election reporting, I previously posed on importing a directory of .csv files. At present, that is what I can find to build this. What does the interface look like? library(magick) Img <- image_read("./img/SShot.png") image_ggplot(Img) This is terrible, there is a javascript button to download each separately. Nevertheless, here we go.

January 26, 2022

Trademarks from the Oregon Secretary of State

Oregon’s Open Data Portal The Oregon Open Data Portal has a bunch of easily accessible public use data. One of the first listings today was trademarks issued by the Oregon Secretary of State. Let’s grab that data. OTM <- read.socrata('https://data.oregon.gov/resource/ny3n-dx3v.json') head(OTM) ## registration_number registration_date ## 1 102 1968-03-15 ## 2 103 1968-03-15 ## 3 272 1970-10-26 ## 4 3606 1935-02-01 ## 5 3957 1936-04-21 ## 6 4020 1936-08-29 ## trademark_description ## 1 "SR" MONOGRAM ## 2 "SUNRIVER" ## 3 G.

August 23, 2021

Parameterized RMarkdown is Amazing

Parameterized R Markdown A while back, I learned that you can parameterize markdown. You can send it something to process as argument. This is amazing. Let me show an example. First, I want to build an RMarkdown file. In RStudio, that is File > New file > R Markdown. We will need to add a bit of metadata to the top. The key component is the params: argument. I want to pass a ticker with a default option.

August 21, 2021

ARCH and GARCH Models

NKE First, let me use tidyquant to acquire the data. library(tidyquant); library(tidyverse) NKE <- tq_get("NKE", from="2019-01-01") NKE ## # A tibble: 918 × 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> ## 1 NKE 2019-01-02 72.8 74.6 72.2 74.1 6762700 71.7 ## 2 NKE 2019-01-03 73.2 73.3 71.2 72.8 8007400 70.4 ## 3 NKE 2019-01-04 73.4 75.1 73.1 74.

April 26, 2021

slider is a magical way of creating moving averages

Nike’s Stock # Load libraries library(tidyquant) library(tidyverse) library(fpp3) With those libraries, I should have what I need. Let me get Nike’s stock from 2015. # Get Nike stock data Nike.Stocks <- tq_get("NKE", from="2015-01-01") Nike.Stocks %>% as_tsibble(index=date) %>% autoplot(adjusted) + labs(y="Adjusted Closing Price", title="NKE since 2015") Now I want to create monthly data. I will the yearmonth type from lubridate. By default, tidyquant uses yearmon which is different. # Create nike returns, need tq_transmute because we are taking daily data and turning it into monthly.

March 16, 2021

tabulizer Rocks

Voter Turnout in Oregon Oregon’s voter turnout data is published by the Oregon Secretary of State’s office. You can find a direct link to the .pdf here. How hard is to recover a .pdf table? Let’s see. I am going to work with tabulizer. library(tabulizer) library(dplyr) The key function for this will be extract_tables; with knowledge of that let’s see if it just automagically works. library(kableExtra) location <- 'https://sos.

March 4, 2021

tidyTuesday on Superbowl Commercials

The tidyTuesday data for the week of March 4, 2021 represent 247 rows of Superbowl advertisements coded on a few dimensions by fivethirtyeight. The original article uses 233 and there are a few with at least some missing features in the dataset. The idea was to use binary evaluations of patriotic, funny, uses sex, and a host of other characteristics to describe the universe of Super Bowl ads. One thing that stands out is the difference between Budweiser and Bud Light.

Menu