R packages for sentiment analysis include sentimentr and sentimentanalysis found on CRAN. Another way to do sentiment analysis is to use Viral Hearts API found here.
These packages allow have Bayesian classifiers such as Naive Bayes to help you in classifying emotions or positivity/negativity of your comments.
This here is sample implementation of how to do this in R:
# Create small vectors for happy and sad words (useful in aggregate(...) function)
positive <- c('happy', 'well-off', 'good', 'happiness')
negative <- c('sad', 'bad', 'miserable', 'terrible')
# Words to test sentiment
test <- c('I am a very happy person.', 'I am a very sad person',
'I’ve always understood happiness to be appreciation. There is no greater happiness than appreciation for what one has- both physically and in the way of relationships and ideologies. The unhappy seek that which they do not have and can not fully appreciate the things around them. I don’t expect much from life. I don’t need a high paying job, a big house or fancy cars. I simply wish to be able to live my life appreciating everything around me.
')
#Classify is the name for the packages object
2. Naive Bayes
out <- classify.naivebayes(test)
out