Twitter Outer Limits : Seeing How Far Have Folks Fallen Down The Slippery Slope to “280” with rtweet
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
By now, virtually every major media outlet has covered the “280 Apocalypse”™. For those still not “in the know”, Twitter recently moved the tweet character cap to 280 after a “successful” beta test (some of us have different ideas of what “success” looks like).
I had been on a hiatus from the platform for a while and planned to (and did) jump back into the fray today but wanted to see what my timeline looked like tweet-length-wise. It’s a simple endeavour: use rtweet
to grab the timeline, count the characters per-tweet and look up the results. I posted the results of said process to — of course — Twitter and some folks asked me for the code.
Others used it and there were some discussions as to why timelines looked similar (distribution-wise) with not many Tweets going over 140 characters. One posit I had was that it might be due to client-side limitations since I noted that Twitter for macOS — a terrible client they haven’t updated in ages (but there really aren’t any good ones) — still caps tweets at 140 characters. Others, like Buffer on the web, do have support for 280, so I modified the code a bit to look at the distribution by client.
Rather than bore you with my own timeline analysis, and to help the results be a tad more reproducible (which was another discussion that spawned from the tweet-length tweet), here’s a bit of code that tries to grab the last 3,000 tweets with the #rstats
hashtag and plots the distribution by Twitter client:
library(rtweet) library(ggalt) library(rprojroot) library(hrbrthemes) library(tidyverse) rt <- find_rstudio_root_file() rstats_tweet_data_file <- file.path(rt, "data", "2017-11-13-rstats-tweet-search-results.rds") if (!file.exists(rstats_tweet_data_file)) { rstats <- search_tweets("#rstats", 3000) # setting up rtweet is an exercise left to the reader write_rds(rstats, rstats_tweet_data_file) } else { rstats <- read_rds(rstats_tweet_data_file) } rstats <- mutate(rstats, tweet_length=map_int(text, nchar)) # get the tweet length for each tweet count(rstats, source) %>% filter(n > 5) -> usable_sources # need data for density + I wanted a nice grid :-) # We want max tweet length & total # of tweets for sorting & labeling facets filter(rstats, source %in% usable_sources$source) %>% group_by(source) %>% summarise(max=max(tweet_length), n=n()) %>% arrange(desc(max)) -> ordr # four breaks per panel regardless of the scales (we're using free-y scales) there_are_FOUR_breaks <- function(limits) { seq(limits[1], limits[2], length.out=4) } mutate(rstats) %>% filter(source %in% usable_sources$source) %>% mutate(source = factor(source, levels=ordr$source, labels=sprintf("%s (n=%s)", ordr$source, ordr$n))) %>% ggplot(aes(tweet_length)) + geom_bkde(aes(color=source, fill=source), bandwidth=5, alpha=2/3) + geom_vline(xintercept=140, linetype="dashed", size=0.25) + scale_x_comma(breaks=seq(0,280,70), limits=c(0,280)) + scale_y_continuous(breaks=there_are_FOUR_breaks, expand=c(0,0)) + facet_wrap(~source, scales="free", ncol=5) + labs(x="Tweet length", y="Density", title="Tweet length distributions by Twitter client (4.5 days #rstats)", subtitle="Twitter client facets in decreasing order of ones with >140 length tweets", caption="NOTE free Y axis scales\nBrought to you by #rstats, rtweet & ggalt") + theme_ipsum_rc(grid="XY", strip_text_face="bold", strip_text_size=8, axis_text_size=7) + theme(panel.spacing.x=unit(5, "pt")) + theme(panel.spacing.y=unit(5, "pt")) + theme(axis.text.x=element_text(hjust=c(0, 0.5, 0.5, 0.5, 1))) + theme(axis.text.y=element_blank()) + theme(legend.position="none")
FIN
While the 140 barrier has definitely been broken, it has not been abused (yet) but the naive character counting is also not perfect since it looks like it doesn’t “count” the same way Twitter-proper does (image “attachments”, as an example, are counted as characters here here but they aren’t counted that way in Twitter clients). Bots are also counted as Twitter clients.
It’ll be interesting to track this in a few months as folks start to inch-then-blaze past the former hard-limit.
Give the code (or use your timeline info) a go and post a link with your results! You can find an RStudio project directory over on GitHub ?.
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.