I am trying to write a code in r to do sentiment analysis by exporting and analyzing tweets,the following code is supposed to clean the tweet call up the sentiment package do the scoring and return back the result , this code has been cited in many tech blogs the code is as follows :
score.sentiment = function(sentences , pos.words, neg.words , progress='none')
{
require(plyr)
require(stringr)
scores = laply(sentences,function(sentence,pos.words,neg.words)
{
sentence =gsub('[[:punct:]]','',sentence)
sentence =gsub('[[:cntrl]]','',sentence)
sentence =gsub('\\d+','',sentence)
sentence=tolower(sentence)
word.list=str_split(sentence,'\\s+')
words=unlist(word.list)
pos.matches=match(words,pos.words)
neg.matches=match(words,neg.words)
score=sum(pos.matches)-sum(neg.matches)
return(score)
},pos.words,neg.words,.progress=.progress)
scores.df=data.frame(scores=scores,text=sentences)
return(scores.df)
}
However i keep on getting the following error:
Error in score.sentiment(Datasetgaza$text, pos.words, neg.words, .progress = "text") : unused argument (.progress = "text")
The argument passed was: gaza.scores=score.sentiment(Datasetgaza$text,pos.words,neg.words,.progress='text')
any help with the code would be very appreciated