Text Mining with R: A Tidy Approach

About the book

This book applies tidy data principles to text analysis. The aim is to present tools to make many text mining tasks easier, more effective, and consistent with tools already in use, and in particular it presents the tidytext R package.

I love this ebook, at the moment you can read the chapter at the book's website, and I want it to be soon available on Amazon to have a paperback copy.

The authors of this beautiful exposition of methodology and coding are Julia Silge and David Robinson. Kudos to both of them. In particular, I've been following Julia's blog posts in the last two years and using it as a reference to teach R in my courses.

Table of contents

List of chapters:

  1. The tidy text format
  2. Sentiment analysis with tidy data
  3. Analyzing word and document frequency: tf-idf
  4. Relationships between words: n-grams and correlations
  5. Converting to and from non-tidy formats
  6. Topic modeling
  7. Case study: comparing Twitter archives
  8. Case study: mining NASA metadata
  9. Case study: analyzing usenet text
  10. References

Remarkable contributions of this book

In my opinion chapter 5 is one of the best expositions of data structures in R. By using modern R packages such as dplyr and tidytext, among other packages, the authors move between tibble, DocumentTermMatrix and VCorpus, while they present a set of good practises in R and do include ggplot2 charts to make concepts such as sentiment analysis clear.

If you often hear colleagues saying that R syntax is awkward, show this material to them. Probably people who used R 5 years ago or more, and haven't used it in a while, will be amazed to see how the %>% operator is used here.

Text analysis requires working with a variety of tools, many of which have inputs and outputs that aren’t in a tidy form. What the authors present here is a noble and remarkable piece of work.