Learn
Interquartile Range
IQR in R

In the last exercise, we calculated the IQR by finding the quartiles using R and finding the difference ourselves. The stats library has a function that can calculate the IQR all in one step.

The IQR() function takes a dataset as a parameter and returns the Interquartile Range.

dataset = c(4, 10, 38, 85, 193) interquartile_range = IQR(dataset)

Instructions

1.

Let’s calculate the IQR again, but this time, use the stats function.

Create a variable named interquartile_range and set it equal to the result of calling IQR() using songs as an argument.

Folder Icon

Take this course for free

Already have an account?