Skip to content

Instantly share code, notes, and snippets.

View mkearney's full-sized avatar
📈
Data Sciencing

Michael W. Kearney mkearney

📈
Data Sciencing
View GitHub Profile
@mkearney
mkearney / impeachment-twitter-sentiment-plot.R
Last active October 12, 2020 20:52
Visualizing Sentiment Analysis of Tweets about the 2019 Impeachment Hearings
## install these if not already
pkgs <- c("remotes", "syuzhet", "tfse", "rtweet", "ggplot2", "dplyr", "tidyr")
if (length(pkgs <- pkgs[!pkgs %in% installed.packages("remotes")]) > 0) {
install.packages(pkgs)
}
## install from github
remotes::install_github("mkearney/dataviz")
remotes::install_github("mkearney/dict")
@mkearney
mkearney / nevada-caucus-tweets-2020.R
Created February 22, 2020 22:12
Collect (via Twitter's stream API) tweets from 2020 Nevada Caucus
## load rtweet
library(rtweet)
## store bounding box coordinates for state of nevada
nv <- c(-120.00647, 35.00186, -114.03965, 42.00221)
## initialize output vector and Midwestern 'ope' counter
s <- list()
ope <- 0L
@mkearney
mkearney / rtweets-revenge.R
Last active April 22, 2023 02:09
Using rtweet v0.7.0 to search Twitter's standard API
#------------------------------------------------------------------------------#
# API KEYS/SECRETS
#------------------------------------------------------------------------------#
# twitter keys - these are fake replace these with your twitter keys found
# at https://developer.twitter.com/en
# be careful with these – do not share or save to cloud. use environment
# variables, follow best practices, don't be careless :)
consumer_key = "IYWxHaPxjpalssdfkj"
consumer_secret = "Cyx8OqcOtniCe63ZmaPxvvq6HvstV6PuS1AjwY9g1awnbaIUp4"