Skip to content

Instantly share code, notes, and snippets.

View JakeRuss's full-sized avatar

Jake Russ JakeRuss

View GitHub Profile
@JakeRuss
JakeRuss / clean-up-pdftools.R
Created December 17, 2018 16:09
table-izing the output from pdftools 2.0
library(pdftools)
library(tidyverse)
library(janitor)
pdf_file <- "https://github.com/ropensci/tabulizer/raw/master/inst/examples/data.pdf"
df <- pdf_data(pdf_file)[[1]]
# Table-ize ----
@JakeRuss
JakeRuss / badJSON.R
Last active August 29, 2015 14:27
Parse Claritin json string
library(jsonlite)
url <- "http://www.claritin.com/webservice/allergyforecast.php?zip=33956"
df <- fromJSON(url)
@JakeRuss
JakeRuss / toAmericanOdds.R
Created October 26, 2014 23:17
Convert decimal betting odds to American format
# Convert decimal betting odds to American format
#
toAmericanOdds <- function(x) {
if (!is.numeric(x))
x <- as.numeric(x)
# For decimal odds greater than or equal to 2,
# American odds = (decimal odds – 1) * 100