Get startedGet started for free

Vectorized operation continued...

This exercise is part of the course

Data Science R Basics

View Course

Exercise instructions

  • Compute the per 100,000 murder rate for each state and store it in the object murder_rate.
  • Then compute the average of the state murder rates for the US using the function mean. What is this average?

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the data
library(dslabs)
data(murders)

# Store the per 100,000 murder rate for each state in murder_rate

# Calculate the average murder rate in the US 
Edit and Run Code