fixed various logic bugs. Improved feedback
This commit is contained in:
@@ -69,20 +69,22 @@ for(a in 1:nrow(acc_df)) {
|
||||
}
|
||||
|
||||
# Now sleep 3 second to dodge 300queries/15min limit
|
||||
cat("User:",user,"in loop:",loop,"- now waiting 2 secs...\n")
|
||||
stat_tweet <- nrow(tweets_full)
|
||||
cat("[",a,"/",nrow(acc_df),"] ", sep = "")
|
||||
cat("User: ",user," in loop: ",loop,". \n", sep = "")
|
||||
Sys.sleep(2)
|
||||
|
||||
# Is the last tweet in tweets_full from 2013?
|
||||
status <- str_detect(tweets_full$created_at[nrow(tweets_full)], "2013$")
|
||||
status <- str_detect(tweets_full$created_at[nrow(tweets_full)], "2014$")
|
||||
# Last loop is reached. Now clear the data frame
|
||||
if (status) {
|
||||
if (!status) { # Starting when tweet not from 2014
|
||||
|
||||
# Delete all tweets from 2013
|
||||
old <- 0
|
||||
for(r in 1:nrow(tweets_full)) {
|
||||
status <- str_detect(tweets_full$created_at[r], "2013$")
|
||||
status <- str_detect(tweets_full$created_at[r], "2014$")
|
||||
if(is.na(status)) { status <- FALSE }
|
||||
if(status) {
|
||||
if(!status) { # Starting when tweet not from 2014
|
||||
old <- old + 1
|
||||
}
|
||||
}
|
||||
@@ -104,7 +106,7 @@ for(a in 1:nrow(acc_df)) {
|
||||
}
|
||||
|
||||
# Every tweet from 2014 from user[r] is downloaded. Now next user in for-loop
|
||||
cat("User:",user,"finished after",loop,"loops\n")
|
||||
cat("User:",user,"finished after",loop,"loops. Total Tweets now:",nrow(tweets_full),"\n")
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user