The vote column in the dataset has a number that represents that country’s vote:
1 = Yes
2 = Abstain
3 = No
8 = Not present
9 = Not a member
One step of data cleaning is removing observations (rows) that you’re not interested in. In this case, you want to remove “Not present” and “Not a member”.
开始练习:
Load the dplyr package.
Print the votes table.
Filter out rows where the vote recorded is “not present” or “not a member”, leaving cases where it is “yes”, “abstain”, or “no”.
提示:
You’ll want to pipe (%>%) the votes table into a filter() step. Note that the condition vote <= 3 will keep the observations you want.
plot relationship between expense on radio and sales: