which
The function which()
helps us know directly, which values are low or high, etc. Let's use it in this question.
This exercise is part of the course
Data Science R Basics
Exercise instructions
- Use the results from the previous exercise and the function
which
to determine the indices ofmurder_rate
associated with values lower than 1.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Store the murder rate per 100,000 for each state, in murder_rate
murder_rate <- murders$total/murders$population*100000
# Store the murder_rate < 1 in low
low <- murder_rate < 1
# Get the indices of entries that are below 1