Exercise

Find the most frequent words in a text

We will now turn to partitioning by data. Here is an example that will be used throughout the course: In the given text, find the most frequent words that start with each letter of the alphabet and are at least a given length long. You'll use the janeaustenr package with its 6 books by Jane Austen, which is available in your environment. Also loaded are the stringr package and the function janeausten_words(), which extracts words from the 6 books and converts them to lowercase. Here, the specific task is to find, for each letter of the alphabet, the most frequent word that is at least five characters long. Your job is to partition this task into independent pieces.

Instructions 1/3

undefined XP
    1
    2
    3
  • The object words contains all words from the 6 books. Use the preloaded function max_frequency() to find the most frequent word of all words starting with an "a" (arg letter) that are 5 or more characters long (arg min_length).