November 9, 2022
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.
Loading NWS Data I first will try to load it without any intervention to see what it looks like. As we will see, it is quite messy in a few easy ways and a few that are a bit more tricky.
NWS <- read.csv(url("https://www.weather.gov/source/pqr/climate/webdata/Portland_dailyclimatedata.csv")) head(NWS, 10) %>% kable() %>% kable_styling() %>% scroll_box(width = "100%", height = "500px") Daily.Temperature.and.Precipitation.Data X X.1 X.2 X.
The Federal Reserve Bank of New York provides interesting data on inflation expectations. I was first interested in this because it appears as though the survey respondents have consistently overestimated inflation expectations over the last few years. But now, in a time of heightened concern about inflation, it is worthwhile to revisit the data.
library(tidyverse) library(lubridate); library(tsibble) library(readxl); library(magrittr) library(kableExtra) url <- "https://www.newyorkfed.org/medialibrary/interactives/sce/sce/downloads/data/frbny-sce-data.xlsx" destfile <- "frbny_sce_data.xlsx" curl::curl_download(url, destfile) Inflation.
Loading NWS Data I first will try to load it without any intervention to see what it looks like. As we will see, it is quite messy in a few easy ways and a few that are a bit more tricky.
NWS <- read.csv(url("https://www.weather.gov/source/pqr/climate/webdata/Portland_dailyclimatedata.csv")) head(NWS, 10) %>% kable() %>% kable_styling() %>% scroll_box(width = "100%", height = "500px") Daily.Temperature.and.Precipitation.Data X X.1 X.2 X.
Getting to Yes Let’s have a brief look at Getting to Yes.
What are the most common words? library(tidyverse) library(tidytext) library(wordcloud) load("data/SharedGTY.RData") GTY.WM <- Getting.To.Yes.TDF %>% unnest_tokens(word, text) tidy_book <- GTY.WM %>% anti_join(stop_words) # The barplot tidy_book %>% count(word, sort = TRUE) %>% filter(n > 50) %>% mutate(word = reorder(word, n)) %>% ggplot(aes(word, n)) + geom_col() + xlab(NULL) + coord_flip() A Wordcloud? # Make the wordcloud tidy_book %>% count(word) %>% with(wordcloud(word, n, max.
In Class I mentioned the Pigeon It really is an amazing pigeon. Apologies that I haven’t a photo credit for it; I found it one day on twitter as it went viral. It is a New York City pigeon.
Pigeon
I want to color something with colors from that pigeon. First, I have to get the color palette.
imgpalr R has a package called imgpalr that will extract colors from an image.
Data There is a ton of data in the worldfootballR package; the github for the package is linked here. This particular analysis uses data from transfermarkt. I am going to grab player market values for the top five European leagues.
library(tidyverse); library(here) library(worldfootballR) options(scipen=9) Big_5_player_values <- get_player_market_values(country_name = c("England", "Spain", "France", "Italy", "Germany"), start_year = 2021) ## Warning: Expected 4 pieces. Missing pieces filled with `NA` in 2660 rows [1, 2, ## 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, .