Skip to content

Instantly share code, notes, and snippets.

View jthomasmock's full-sized avatar

Tom Mock jthomasmock

View GitHub Profile
@jthomasmock
jthomasmock / glue::glue example
Created August 16, 2018 18:34
Basic example of glue usage
tribble_df <- tribble(~day, ~person, ~action,
"Monday", "Tom", "sprinting",
"Tuesday", "Susan", "strolling",
"Saturday", "Wonder Woman", "flying")
tribble_df %>%
mutate(glue_output = glue::glue("On {day} I realized {person} was {action} by the street"))
This is a test of gistfo
# https://git.io/fhOAx
This is a test of gistfo
# https://git.io/fhOxv
@jthomasmock
jthomasmock / rstudio-conf-tacos.rmd
Last active January 12, 2019 22:27
A map of the best tacos in Austin for RStudio::Conf via Caitlin Hudon
---
title: "The Best Tacos in Austin according to Caitlin Hudon"
output:
flexdashboard::flex_dashboard:
orientation: column
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
---
title: "Tweet Test"
author: "Thomas Mock"
date: "1/16/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
library(rvest)
library(tidyverse)
# get the data
url <- "https://en.wikipedia.org/wiki/List_of_most-streamed_songs_on_Spotify"
df <- url %>%
read_html() %>%
html_table(fill = TRUE) %>%
@jthomasmock
jthomasmock / epa_vs_ol.R
Last active July 29, 2019 15:11
EPA per carry vs Adj O Line rating
library(tidyverse)
library(rvest)
library(ggrepel)
# url for the o-line stats
url_ol <- "https://www.footballoutsiders.com/stats/ol"
ol_rank <- url_ol %>%
read_html() %>%
html_table() %>%
# load
library(tidyverse)
library(ggridges)
library(ggtext)
library(gt)
# read data
pbp_df <- read_rds("pbp_all.rds")
# 2018 and pass plays
@jthomasmock
jthomasmock / nfl_big_databowl.R
Last active October 16, 2019 03:54
Filter single observations
filter_data <- df_clean %>%
filter(yard_line >= 20, down %in% c(1, 2), between(defenders_in_the_box, 5, 9)) %>%
mutate(defenders_in_the_box = factor(defenders_in_the_box)) %>%
filter(distance <= 10) %>%
group_by(nfl_id_rusher, game_id, play_id) %>%
slice(1)
filter_data2 <- df_clean %>%
filter(yard_line >= 20, down %in% c(1, 2), between(defenders_in_the_box, 5, 9)) %>%
mutate(defenders_in_the_box = factor(defenders_in_the_box)) %>%
@jthomasmock
jthomasmock / weekly_qbr.R
Last active May 16, 2021 22:30
NFL Weekly QBR gganimate
# Resources
# Please note this will eventually make it's way over to my NFL Plotting Guide
# Check it out at: https://jthomasmock.github.io/nfl_plotting_cookbook/
original_url <- "http://www.espn.com/nfl/qbr/_/type/player-week/week/1"
gganimate_wiki <- "https://github.com/thomasp85/gganimate/wiki/Temperature-time-series"
gganimate_homepage <- "https://gganimate.com/"
# Load Libraries ----------------------------------------------------------