filter with !=
We can remove rows using the !=
operator. For example to remove Florida we would do this:
no_florida <- filter(murders, state != "Florida")
This exercise is part of the course
Data Science R Basics
Exercise instructions
- Create a new data frame called
no_south
that removes states from the South region. - How many states are in this category? You can use the function
nrow
for this.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Use filter to create a new data frame no_south
# Use nrow() to calculate the number of rows