lockedata / twitterbookdraw

R Package πŸ“¦ for drawing a random :game_die: Locke Data follower to win a book :book:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Produce a visualization of the winner of the book of the month

Each month, a random Locke Data follower wins a book! See it for yourself in this Twitter moment, and follow Locke Data if you want to try and win a book next month!

Winners have always been sampled via R ( twitteR and now rtweet). Since 2018/03, the winner is announced with a fun R viz as well! This repo contains the code for such visualizations.

Results!

2018-08-01

Now gifski is on CRAN! But gganimate's latest version isn't.

This code cannot be run in RStudio cf rstudio/rstudio#2919

# devtools::install_github("thomasp85/gganimate")
# or fetch the artifact from https://ci.appveyor.com/project/thomasp85/gganimate/build/artifacts
# devtools::install_github("lockedata/twitterbookdraw")
# draw winner
winner <- twitterbookdraw::draw_winner()

# prepare tweet text
book <- 'Weapons of math destruction'
book_url <- "http://geni.us/mathdestruction"
twitterbookdraw::announce_winner(winner, book, book_url)

# save gif as "destruction.gif"
# a folder called august_frames will be created
# and then deleted
twitterbookdraw::show_august_winner(winner = winner, path = "destruction.gif")

2018-07-01

Install gifski from https://github.com/r-rust/gifski or if you're on Windows grab the pre-compiled binary at https://ci.appveyor.com/project/jeroen/gifski/build/artifacts

# devtools::install_github("lockedata/twitterbookdraw")
# draw winner
winner <- twitterbookdraw::draw_winner()

# prepare tweet text
book <- 'SQL Cookbook'
book_url <- "http://geni.us/sqlcookbook"
twitterbookdraw::announce_winner(winner, book, book_url)

# save gif as "june.gif"
twitterbookdraw::show_july_winner(winner = winner, path = "july.gif")

2018-06-01

# devtools::install_github("lockedata/twitterbookdraw")
# draw winner
winner <- twitterbookdraw::draw_winner()

# prepare tweet text
book <- 'An Introduction to Statistical Learning: with Applications in R'
book_url <- "http://geni.us/introtostatslearning"
twitterbookdraw::announce_winner(winner, book, book_url)

# save gif as "june.gif"
twitterbookdraw::show_june_winner(winner = winner, path = "june.gif")

2018-05-01

Code

That month's creation was also described more thoroughly in a blog post, "A particles-arly fun book draw".

@SQLBob won @juliasilge and @drob fantastic book on NLP https://t.co/DEM04WY9W4! πŸ“• Bob, DM us!

"Bag of followers" code https://t.co/L20gPDzLj6 thanks to @thomasp85's particles #rstats package pic.twitter.com/GybtPcfMMI

β€” Locke Data (@LockeData) 1 de maig de 2018

2018-04-01

Code

The winner πŸ† of our March Book πŸ“• giveaway is @sqlStride!
Simon, you've won a copy of Dear Data - DM us so we can get your address

πŸ“•: https://t.co/wQvFeiesaT
πŸ‘© πŸ’»: https://t.co/UZT0o5VoUv pic.twitter.com/zmCrQwT4ZL

β€” Locke Data (@LockeData) 2 d’abril de 2018

2018-03-01

Code

This month's book πŸ“• winner is @kevbros93! πŸ†

Kevin, DM us to give us your address :)https://t.co/ZPfNzJlrdD pic.twitter.com/zc0IePm96q

— Locke Data (@LockeData) 1 de març de 2018

About

R Package πŸ“¦ for drawing a random :game_die: Locke Data follower to win a book :book:


Languages

Language:R 100.0%