Twitter Meme

R starter template



library(ggplot2)
library(dplyr)
library(gapminder)
library(rtweet)

gapminder %>%
  filter(year==2007) %>%
  ggplot() + 
  geom_point(
    aes(x = gdpPercap, y = lifeExp,  color = continent, size = pop),
    alpha = 0.7
  )
ggsave("gapminder.png")


# Send Meme via Twitter
token <- create_token(
  app = "QuantargoBot",
  consumer_key = Sys.getenv("TWITTER_API_KEY"),
  consumer_secret = Sys.getenv("TWITTER_API_SECRET"),
  access_token = Sys.getenv("TWITTER_ACCESS_TOKEN"),
  access_secret = Sys.getenv("TWITTER_ACCESS_SECRET")
)

post_tweet(status = "Gapminder Plot from @HansRosling excellent talk. #rstats", token = token, media = "gapminder.png")

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.