added coding sample tests

This commit is contained in:
2015-01-15 20:24:40 +01:00
parent 0ea1d11100
commit a4b966965b
12 changed files with 567 additions and 366 deletions
+6 -3
View File
@@ -176,19 +176,22 @@ tweets <- tweets[order(tweets$created_at), ]
# Finally delete every tweet not from 2014 (2013 or 2015)
delrow <- NULL
pb <- txtProgressBar(min = 0, max = nrow(tweets), style = 3)
for(r in 1:nrow(tweets)) {
if(format(tweets$created_at[r], "%Y") != "2014") {
delrow <- c(delrow, r)
}
setTxtProgressBar(pb, r)
curtext <- as.character(tweets$text[r])
curtext <- str_replace_all(curtext, "$", " ")
curtext <- str_replace_all(curtext, "http://.+?\\s", "URL ")
tweets$text[r] <- curtext
}
tweets <- tweets[-delrow, ]
rm(delrow, r)
# Convert dates to omit (unnecessary) time
tweets$created_at <- format(tweets$created_at, "%Y-%m-%d")
save(tweets, file="tweets.RData")
save(tweets, file="tweets_untagged.RData")