Skip to content

Instantly share code, notes, and snippets.

View monogenea's full-sized avatar

Francisco Lima monogenea

View GitHub Profile
# Wed May 8 21:22:45 2019 ------------------------------
# Use status_id to identify and exclude duplicates
library(rtweet)
# List all files
allFiles <- paste0("tweets/", list.files("tweets/"))
# Write function to merge tweets
mergeTweets <- function(recipient, donor){
idx <- !donor$status_id %in% recipient$status_id
# Read GOT tweets from US
newTweets <- search_tweets(q = "game of thrones",
retryonratelimit = T, lang = "en",
geocode = lookup_coords("usa", apikey = apiKey),
include_rts = FALSE, n = 1e5) # 1st day 3e5, to go back ~1 week
# Specify dir
dirPath <- "~/Documents/INSERT_PATH"
# Create dir for storage
# Google Maps API https://developers.google.com/maps/documentation/javascript/get-api-key
apiKey <- "INSERT_HERE"
#!/Library/Frameworks/R.framework/Resources/Rscript
# Mon Apr 15 18:41:47 2019 ------------------------------
library(rtweet)
# Twitter API
create_token(app = "INSERT_HERE",
consumer_key = "INSERT_HERE",
consumer_secret = "INSERT_HERE",
access_token = "INSERT_HERE",
access_secret = "INSERT_HERE")