Exercise

Exercise 3

In this case study, we will find and visualize summary statistics of the text of different translations of Hamlet. For this case study, functions count_words_fast, read_book, and word_stats are already defined as in the Case 2 Videos (Videos 3.2.x)

In this exercise, we will continue to define summary statistics for a single translation of Hamlet. The solution code from the previous section is already included here.

Instructions

100 XP
  • Add a column to data named length, defined as the length of each word.
  • Add another column named frequency, which is defined as follows for each word in data:
    • If count > 10, frequency is frequent.
    • If 1 < count <= 10, frequency is infrequent.
    • If count == 1, frequency is unique.