An example on sentiment analysis with R

by Yanchang Zhao,

There is a nice example on sentiment analysis with R at <>.

In the example, the Wikileaks cable corpus is analyzed to track US sentiments of other countries and their presidents over time. The example describes how to map sentences to a sentiment score of -5 to 5 with the AFINN list. It also introduces named entity recognition with the JRC-Names word list. Moreover, it uses random indexing technique to build up a matrix of topic words and sentiment words.

It is a good example to learn from to start your own sentiment analysis.

About Yanchang Zhao

I am a data scientist, using R for data mining applications. My work on R and data mining:; Twitter; Group on Linkedin; and Group on Google.
This entry was posted in Data Mining, R and tagged , , . Bookmark the permalink.

6 Responses to An example on sentiment analysis with R

  1. Pingback: An example on sentiment analysis with R | RDataMining | Social Media Analytics and US Politics |

  2. Raj Kumar says:

    Hi Yanchang,
    Your example on “” is great.
    However it is possible to do sentiment analysis ( ie score each tweet) for time series plots.
    It is possible to use tweeter specific feature such as ‘RT’ for analysis and than applying page rank algothim/graph rank algrothim to pick up best score.

    Hope to hear from you soon.



  3. rahuldebchakladar says:

    Hi I need to do the sentiment analysis on restaurant data.I am not understanding how to convert it into positive and negative data for the scoring sentiment.I want to know how can i break the text into postive and negative text and then use it as a input for sentiment analysis

  4. A common way is to find a publicly available list of positive/negative words, and then you can map your text into counts of positive/negative words and sentiment scores.

  5. Pingback: URL

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s