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.
IQR() function takes a dataset as a parameter and returns the Interquartile Range.
dataset = c(4, 10, 38, 85, 193) interquartile_range = IQR(dataset)
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
songs as an argument.