1. Sentiment analysis: Background; 2. Methods for sentiment analysis; 3. How to do sentiment analysis with R; 4. Case study 1: A diachronic analysis of sentiments and emotions in the State of the Union Addresses; 5. Case study 2: A sentiment and emotion analysis of movie reviews; 6. Conclusion: Where we are and where we are heading; References.