Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

ColinFay/tweetthat

Repository files navigation

tweetthat

lifecycle

A simple wrapper to tweet straight from your R session.

  • Open a widget to send tweets (you’ll need a Twitter token to do that)

  • Opens your browser with a text ready to tweet. You need to add a text, and url & via are optional.

Install

devtools::install_github("ColinFay/tweetthat")

With the widget

Using the widget allows you to send images from your computer:

Before using the widget, you should create a Twitter App with read and write permission on apps.twitter.com. Then run :

## whatever name you assigned to your created app
appname <- "myapp"

## api key (example below is not a real key)
key <- "84618490-BpSmqfwIWx6ZkeFDVg6FDZ7LUsMRrzdBPzuc1YT"

## api secret (example below is not a real key)
secret <- "EWXOpTjIpqM8EmHCGHd5xGQKFeCsUfeqWk5NgPtLIRi"

## create token named "twitter_token"
twitter_token <- rtweet::create_token(
  app = appname,
  consumer_key = key,
  consumer_secret = secret)

(taken from the rtweet vignette)

You can check the .Renviron variable is set well with:

usethis::edit_r_environ()

There should be a TWITTER_PAT= var here, with a link to a .Rds.

With the function

The function doesn’t need a Twitter token, but you can’t send image from your computer.

library(tweetthat)
tweet_that(text = "I wrote this tweet in RStudio, how cool is that?")
tweet_that(text = "This website is awesome", url = "http://colinfay.me")
tweet_that(text = "Colin's Twitter is full of advices", via = "@_colinfay")
tweet_that(text = "#RStats — Colin's website is cool", url = "http://colinfay.me", via = "@_colinfay")

About

A simple wrapper to tweet straight from your R session.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages