I need your help with these two for loops in R, because it takes literally hours to get the job done and I already tried a few to get the job myself done... :
for (i in 1:nrow(neg.sent.dictionary)){
text <- gsub(neg.sent.dictionary$pattern[i], neg.sent.dictionary$replacement[i], text, fixed =
FALSE)
}
for (i in 1:nrow(sent.dictionary)){
neg.sent.dictionary$scored[i] <- ifelse(grepl(neg.sent.dictionary$feature[i], text, fixed = TRUE),
TRUE, neg.sent.dictionary$scored[i])
}
This is what (neg.)sent.dictionary looks like:
neg.sent.dictionary data
sent.dictionary data
And text is a huge character vector.
I would be very grateful if someone could help me!