Storrrify #satRdayCapeTown 2018

[This article was first published on Posts on Maëlle's R blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

One week ago I was in Cape Town for the local satRday conference, where I had the honor to be one of the two keynote speakers, the other one being sports analytics extraordinaire Stephanie Kovalchik (You can read Stephanie Kovalchik’s account of the conference in this blog post). It was a fantastic experience! The event was very well organized, and 100% corresponds to its description as a “one day conference packed with R goodness”. You can watch all talks on Youtube. In my talk, I presented rOpenSci onboarding system of packages and… wore a hard hat!

It’d be a bit hard for me to really write a good recap of satRday that’d do it justice! Instead, I’ll use rtweet and a bit of html hacking to storrrify it (like Storify, but in R) using my live tweets!

Getting my satRday tweets

To get my own satRday Cape Town tweets, I’ll first get my timeline and then filter tweets containing the official conference hashtag, ”#SatRdayCapeTown”. I shall only keep my tweets.

my_tweets <- rtweet::get_timeline(user = "ma_salmon", n = 5000)
my_satrday_tweets <- dplyr::filter(my_tweets,
                                   stringr::str_detect(text, "[sS]at[rR]day[cC]ape[tT]own"),
                                   !is_retweet)
my_satrday_tweets <- dplyr::arrange(my_satrday_tweets, created_at)

I got 54 tweets.

Embedding tweets

I wanted to embed tweets, not to rtweet::tweet_shot them, because I wanted to display clickable links. I used the Twitter API embed endpoint after reading this webpage. This endpoint isn’t currently included in rtweet.

library("magrittr")
embed_tweet <- function(tweet_id){
  url <-glue::glue("https://twitter.com/ma_salmon/status/{tweet_id}") 
  
  httr::GET("https://publish.twitter.com/oembed",
            query = list(url = url,
                         hide_thread = "true")) %>%
    httr::content() %>%
    .$html
}

I’ll now write all html chunks in an html file.

fs::file_create("satrdaycapetown.html")
embed_and_save <- function(tweet_id){
  embed_tweet(tweet_id) 
}

purrr::map_chr(my_satrday_tweets$status_id, embed_tweet) %>%
  paste() %>%
  writeLines("satrdaycapetown.html", useBytes = TRUE)

And voilà!

I’ll include all tweets below (via a Jekyll include, with the html living in _includes, this is probably very hacky…), happy reading! Thanks again to the organizers, participants and sponsors of SatRday Cape Town for making it such an enjoyable experience!

To leave a comment for the author, please follow the link and comment on their blog: Posts on Maëlle's R blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)