-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtweet-engagement.r
More file actions
34 lines (30 loc) · 903 Bytes
/
Copy pathtweet-engagement.r
File metadata and controls
34 lines (30 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env Rscript
# Syntax: Rscript tweet-engagement.r by-tweet.csv
file <- commandArgs( 1 )
tweets <- read.csv( file, header = TRUE )
# Indicates which tweets garner the most attention
# for my profile
print( "Tweets with more than 5 profile clicks:" )
for( row in 1:nrow( tweets ) ) {
clicks <- tweets[row, "user.profile.clicks"]
if( clicks > 5 ) {
print( tweets[row, "Tweet.text"] )
}
}
# Indicates which tweets garner the most traffic
# for my off-site content
print( "Tweets with multiple URL clicks:" )
for( row in 1:nrow( tweets ) ) {
clicks <- tweets[row, "url.clicks"]
if( clicks > 1 ) {
print( tweets[row, "Tweet.text"] )
}
}
# Indicates which tweets get me the most followers
print( "Tweets with follows:" )
for( row in 1:nrow( tweets ) ) {
follows <- tweets[row, "follows"]
if( follows > 0 ) {
print( tweets[row, "Tweet.text"] )
}
}