Suppose I have a vector (data frame) containing comments (each row is a different comment):
comment
'well done!'
'terrible work'
'quit your job'
'hi'
And I have the following data frame containing positive and negative words (i.e. a dictionary)
positive negative
well terrible
done quit
Is there a way in R to use this dictionary to label the comments in the first data frame either positive, negative or neutral depending on whether they contain more or less positive/negative comments?
I.e. I want the output to be a data frame that looks like:
comment label
'well done!' positive
'terrible work' negative
'quit your job' negative
'hi' neutral
Does anyone know how this can be done in R?