fixed various logic bugs. Improved feedback

This commit is contained in:
2014-12-01 18:51:51 +01:00
parent 92179c6fb0
commit 07266cf219
+8 -6
View File
@@ -69,20 +69,22 @@ for(a in 1:nrow(acc_df)) {
} }
# Now sleep 3 second to dodge 300queries/15min limit # 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) Sys.sleep(2)
# Is the last tweet in tweets_full from 2013? # 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 # Last loop is reached. Now clear the data frame
if (status) { if (!status) { # Starting when tweet not from 2014
# Delete all tweets from 2013 # Delete all tweets from 2013
old <- 0 old <- 0
for(r in 1:nrow(tweets_full)) { 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(is.na(status)) { status <- FALSE }
if(status) { if(!status) { # Starting when tweet not from 2014
old <- old + 1 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 # 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")
} }