Session Ready
Exercise

Radar chart

Remember Plutchik's wheel of emotion? The NRC lexicon has the 8 emotions corresponding to the first ring of the wheel. Previously you created a comparison.cloud() according to the 8 primary emotions. Now you will create a radar chart similar to the wheel in this exercise.

A radarchart is a two-dimensional representation of multidimensional data (at least 3). In this case the tally of the different emotions for a book are represented in the chart. Using a radar chart, you can review all 8 emotions simultaneously.

As before we've loaded the "nrc" lexicon as nrc and moby_huck which is a combined tidy version of both Moby Dick and Huck Finn.

In this exercise you once again use a negated grepl() to remove "positive|negative" emotional classes from the chart. As a refresher here is an example:

object <- tibble %>%
  filter(!grepl("positive|negative", column_name))

This exercise reintroduces spread() which rearranges the tallied emotional words. As a refresher consider this raw data called datacamp.

people food like
Nicole bread 78
Nicole salad 66
Ted bread 99
Ted salad 21

If you applied spread() as in spread(datacamp, people, like) the data looks like this.

food Nicole Ted
bread 78 99
salad 66 21
Instructions 1/2
undefined XP
  • 1
  • 2
  • Review moby_huck with tail().
  • inner_join() moby_huck and nrc.
  • Next, filter() negating "positive|negative" in the sentiment column. Assign the result to books_pos_neg.
  • After books_pos_neg is forwarded to group_by() with book and sentiment. Then tally() the object with an empty function.
  • Then spread() the books_tally by the book and n column.
  • Review the scores data.