始める無料で始める

レベルを手動でまとめる

アンケートでは、人々が選べる職種が16種類("Other" を含む)あります。これらを「Computer Scientist」「Data analyst/scientist/engineer」「Researcher」「Other」の大きなカテゴリにまとめましょう。データセット multiple_choice_responses は読み込まれています。

この演習はコースの一部です

tidyverse で学ぶカテゴリ型データ

コースを見る

演習の手順

  • CurrentJobTitleSelect のレベルを新しい変数 grouped_titles にまとめてください。
  • 次に、grouped_titles で上記3つのグループ化した職種に当てはまらないものをすべて "Other Title" にしてください。
  • 最後に、グループ化後の全タイトルの件数を集計してください。

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

multiple_choice_responses %>%
    # Create new variable, grouped_titles, by collapsing levels in CurrentJobTitleSelect
    ___(grouped_titles = ___(CurrentJobTitleSelect, 
        "Computer Scientist" = c("Programmer", "Software Developer/Software Engineer"), 
        "Researcher" = "Scientist/Researcher", 
        "Data Analyst/Scientist/Engineer" = c("DBA/Database Engineer", "Data Scientist", 
                                              "Business Analyst", "Data Analyst", 
                                              "Data Miner", "Predictive Modeler"))) %>%
    # Keep all the new titles and turn every other title into "Other"
    ___(grouped_titles = ___(grouped_titles, 
                             ___ = c("Computer Scientist", 
                                     "Researcher", 
                                     "Data Analyst/Scientist/Engineer"))) %>% 
    # Get a count of the grouped titles
    ___(___)
コードを編集して実行