There is an R function dedicated to finding the standard deviation of a dataset — we can cut out the step of first finding the variance. The R function sd() takes a dataset as a parameter and returns the standard deviation of that dataset:

dataset <- c(4, 8, 15, 16, 23, 42) standard_deviation <- sd()



We’ve removed the code that calculated the variance of each dataset. By using sd() we don’t need to take that middle step anymore.

Call sd() using nba_data as a parameter, and store the result in nba_standard_deviation.

Make a similar function call using okcupid_data and store the result in okcupid_standard_deviation.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?