LoslegenKostenlos loslegen

Filtering rows

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".

Diese Übung ist Teil des Kurses

Case Study: Exploratory Data Analysis in R

Kurs anzeigen

Anleitung zur Übung

  • 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".

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Load the dplyr package


# Print the votes dataset


# Filter for votes that are "yes", "abstain", or "no"
Code bearbeiten und ausführen