knitr::opts_chunk$set(echo = TRUE)
Detailed instructions on how to create an app on twitter at the following link:
http://rtweet.info/articles/auth.html
If you have already created an app, find all details at the following link and adjust details accordingly in the script below:
https://apps.twitter.com/
library("rtweet") ## whatever name you assigned to your created app app_name <- "name_of_twitter_app" ## store api keys (these are fake example values; replace with your own keys) api_key <- "afYS4vbIlPAj096E60c4W1fiK" api_secret_key <- "bI91kqnqFoNCrZFbsjAWHD4gJ91LQAhdCJXCj3yscfuULtNkuu" access_token <- "9551451262-wK2EmA942kxZYIwa5LMKZoQA4Xc2uyIiEwu2YXL" access_token_secret <- "9vpiSGKg1fIPQtxc5d5ESiFlZQpfbknEN1f1m2xe5byw7" ## authenticate via web browser token <- create_token( app = app_name, consumer_key = api_key, consumer_secret = api_secret_key, access_token = access_token, access_secret = access_token_secret) saveRDS(twitter_token, file = "twitter_token.rds")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.