Skip to content

Instantly share code, notes, and snippets.

jeffgswanson

Block or report user

Report or block jeffgswanson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jeffgswanson
jeffgswanson / gist:3a1d3f731422d258a9efc1492f5b0578
Last active Apr 4, 2017
Forecast website sessions from a CSV document
View gist:3a1d3f731422d258a9efc1492f5b0578
# Install/Library these functions:
library(forecast)
library (tidyr)
library (dplyr)
library (highcharter)
Upload Excel CSV file to R
aa_data <- read.csv("~/[name of file].csv", stringsAsFactors = FALSE, header = TRUE, sep = ",")
# Check data structure of uploaded data
@jeffgswanson
jeffgswanson / gist:04bc9aa38a1037b93c1ef16982011eec
Last active Oct 9, 2017
Access Twitter API to use twitterR
View gist:04bc9aa38a1037b93c1ef16982011eec
# Access Twitter API using twitterR
# Need to have a Twitter account and can access keys, secrets, tokens by creating an app at apps.twitter.com
# Include the single quotes around your access codes
tw_consumer_key <- 'your_consumer_key'
tw_consumer_secret <- 'your_consumer_secret'
tw_access_token <- 'your_access_token'
tw_access_secret <- 'your_access_secret'
setup_twitter_oauth(tw_consumer_key, tw_consumer_secret, tw_access_token, tw_access_secret)
@jeffgswanson
jeffgswanson / gist:b9a8bf21f921b3bd01e306d94beee11b
Created Dec 27, 2017
Scrape table from www.sports-reference.com and place data into a data frame in R
View gist:b9a8bf21f921b3bd01e306d94beee11b
# SCRAPE STATS
library(RCurl)
library(XML)
# Set URL (make sure to use 'getURL' for https/secure sites)
nebrasketball2017_url <- getURL("https://www.sports-reference.com/cbb/schools/nebraska/2018-schedule.html")
# Pull data from second table on the page into a data frame for analysis
nebrasketball2017 <- readHTMLTable(nebrasketball2017_url, header = T, as.data.frame = T)[[2]]
You can’t perform that action at this time.