Skip to content

Instantly share code, notes, and snippets.

@monogenea
Created October 7, 2019 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monogenea/3cc6c11516d57fc69ccbf05b89139d19 to your computer and use it in GitHub Desktop.
Save monogenea/3cc6c11516d57fc69ccbf05b89139d19 to your computer and use it in GitHub Desktop.
# 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
if(!dir.exists(paste0(dirPath, "tweets/"))){
dir.create("tweets/")
}
# Write csv with date
save_as_csv(newTweets, paste0(dirPath, "tweets/", Sys.Date(), ".csv"),
prepend_ids = TRUE, na = "",
fileEncoding = "UTF-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment