Ggplot

Covid-19 Cases in the Central Valley

Data Source: USA Facts — downloaded July 6, 2020 library("tidyverse") library("zoo") start_date <- "5/28/20" end_date <- "7/5/20" county_list <- c("Santa Clara", "Stanislaus", "Calaveras", "San Benito", "Merced", "Tuolumne", "Fresno", "Madera", "Mariposa") lag <- 7 #number of days for rolling average #loads files cases_raw <- read_csv("covid_confirmed_usafacts.csv") populations <- read_csv("covid_county_population_usafacts.csv") Data Wrangling raw_data_merged <- cases_raw %>% full_join(populations, by = c("County Name", "State")) # find column positions by date column_names <- colnames(raw_data_merged) start_loc <- match(start_date, column_names) end_loc <- match(end_date, column_names) cases_filtered <- cases_raw %>% filter(State == "CA") %>% select("County Name", all_of(start_loc:end_loc)) populations_filtered <- populations %>% filter(State == "CA") %>% select("County Name", "population") df_merged <- cases_filtered %>% full_join(populations_filtered, by = "County Name") df_clean <- df_merged %>% # avoids unallocated cases and the cruise ship!

TidyTuesday: Roman Emperors

Introduction Today, for practice with ggplot2, I wish to replicate @JoshuaFeldman’s wonderful #TidyTuesday submission about the dataset of Roman emperors. library("tidyverse") TidyTuesday’s Roman Emperor dataset — posted on August 13, 2019 # TidyTuesday's given line of code to load the data emperors <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-08-13/emperors.csv") Exploring the Data dim(emperors) ## [1] 68 16 colnames(emperors) ## [1] "index" "name" "name_full" "birth" "death" ## [6] "birth_cty" "birth_prv" "rise" "reign_start" "reign_end" ## [11] "cause" "killer" "dynasty" "era" "notes" ## [16] "verif_who" emperors %>% filter(birth_prv !

Recent Supreme Court Cases

Introduction library("tidyverse") Today, I am going to create an overly simplified view of the past 10 Supreme Court decisions for the sake of coding practice with the ggplot package. data source: SCOTUS Blog useful tool: Convert Town’s “Column to Comma Separated Values” function Data Just in case anyone actually uses my blog post, I will type out the data manually instead of load a separate CSV file so that anyone can copy-and-paste the code for replicability.

Introduction to Unsupervised Learning

Unsupervised Learning Supervised learning has the goal of making predictions with a set of known labels for the response variable. In unsupervised learning, we try to find structure in the data of the response variable without predetermined labels. Goal: organize the items available in the Animal Crossing video game Data set: Animal Crossing Source: VillagerDB, MetaCritic, and TidyTuesday Animal Crossing Tidy Tuesday library("ggrepel") library("tidyverse") # critic <- readr::read_tsv('https://raw.

Introduction to Unsupervised Learning

Unsupervised Learning Supervised learning has the goal of making predictions with a set of known labels for the response variable. In unsupervised learning, we try to find structure in the data of the response variable without predetermined labels. Goal: organize the items available in the Animal Crossing video game Data set: Animal Crossing Source: VillagerDB, MetaCritic, and TidyTuesday Animal Crossing Tidy Tuesday library("ggrepel") library("tidyverse") # critic <- readr::read_tsv(‘https://raw.

Hikes I've Completed

Here I will plot some of the hikes I have done as elevation (from sea level) versus distance. I was inspired by this Reddit post Today’s code was great practice with geom_segment geom_label_repel and using xlim and ylim to expand the plot. library(ggrepel) library(tidyverse) library(readxl) df_info <- read_excel("hikes.xlsx", sheet = "info") df_info %>% print() ## # A tibble: 9 x 6 ## Region trail distance trailhead elevation peak ## <chr> <chr> <dbl> <dbl> <dbl> <dbl> ## 1 Tahoe Mt Tallac 5.

Introduction to R Workshop

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: 'ggstance' ## The following objects are masked from 'package:ggplot2': ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

Introduction to R Workshop

Packages workshop_packages <-c("ggplot2", "mosaic", "gganimate") install.packages(workshop_packages) library("gganimate") ## Loading required package: ggplot2 library("ggplot2") library("mosaic") ## Loading required package: dplyr ## ## Attaching package: ‘dplyr’ ## The following objects are masked from ‘package:stats’: ## ## filter, lag ## The following objects are masked from ‘package:base’: ## ## intersect, setdiff, setequal, union ## Loading required package: lattice ## Loading required package: ggformula ## Loading required package: ggstance ## ## Attaching package: ‘ggstance’ ## The following objects are masked from ‘package:ggplot2’: ## ## geom_errorbarh, GeomErrorbarh ## ## New to ggformula?

Supreme Court Confirmations (1967-present)

Introduction Following up on Rachel Wellford’s tweet about Senate votes for Supreme Court confirmations, I decided to try to graph the data. Below, I have a ggplot picture with decent labeling a searchable datatable a plotly interactive graph The data came from Senate.gov. I chose to focus on 1967 onward because it appeared that voting procedures were slightly different before Thurgood Marshall’s nomination process.