Created
October 7, 2019 16:48
-
-
Save monogenea/fe44e40fd317771b2264e90680c69609 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sat Oct 5 10:06:01 2019 ------------------------------ | |
# Bonus - rm bots, time-dependend wordclouds & sentiment analysis | |
rtStats <- do.call("rbind", by(allTweets, INDICES = allTweets$screen_name, function(x){ | |
return(data.frame(num_tweets = nrow(x), | |
mean_followers = mean(x$followers_count), | |
median_rt = median(x$retweet_count))) | |
})) | |
# Plot log10(num_tweets) vs. log10(median_rt) | |
with(log10(rtStats+1), plot(num_tweets, median_rt, | |
cex = mean_followers / max(mean_followers), | |
pch = 16, | |
col = rgb(0,0,0,.25), | |
xlab = expression(paste(log[10], " # tweets + 1")), | |
ylab = expression(paste(log[10], " median # rts + 1")))) | |
nums <- c(1e2, 1e4, 1e6, 1e8) | |
legend("topright", title = "# followers", | |
pch = 16, col = rgb(0,0,0,.25), | |
pt.cex = log10(nums + 1)/max(log10(rtStats$mean_followers + 1)), | |
legend = formatC(nums, format = "e", digits = 1), | |
bty = "n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment