You've successfully subscribed to MyPad Blog
Great! Next, complete checkout for full access to MyPad Blog
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Daily coding - Spying on #rstudioconf2020

Daily coding - Spying on #rstudioconf2020

Let's do a quick #dailycoding exercise. #rstudioconf2020 is on and few of us, unlucky ones, are tracking it on Twitter. :-(

Let's try to make things a little more exciting and track the progress with some code.

Get the data

## load rtweet package

## search for 18000 tweets using the rstudioconf2020 hashtag
rt <- search_tweets(
  "#rstudioconf2020", n = 18000, include_rts = FALSE

tweets <- rt

How is the vibe?

## plot time series of tweets
rt %>%
  ts_plot("3 hours") +
  ggplot2::theme_minimal() +
  ggplot2::theme(plot.title = ggplot2::element_text(face = "bold")) +
    x = NULL, y = NULL,
    title = "Frequency of #rstudioconf2020 Twitter statuses from past 9 days",
    subtitle = "Twitter status (tweet) counts aggregated using three-hour intervals",
    caption = "\nSource: Data collected from Twitter's REST API via rtweet"


Its getting active!

Where are they tweeting from?

tweets %>% 
  filter(! %>% 
  count(place_full_name, sort = TRUE) %>% 
  top_n(5) %>% View


I like the guy in this Tesla :-)

Favorite device?


table_tweet <- data.frame(head(sort(table(tweets$source),decreasing=T),20))

ggplot(table_tweet, aes(x=Var1, y=Freq)) +
  geom_segment( aes(x=Var1, xend=Var1, y=0, yend=Freq)) +
  theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
  labs(title = "Tweets by device/source", x="Device/Source",y="Frequency")+
  geom_point( size=5, color="red", fill=alpha("orange", 0.3), alpha=0.7, shape=21, stroke=2)


Yup! iPhones rock! I'm thinking of shifting to Android now though :)