What is the IQR() function in R?

Overview

In R, the IQR() function is used to compute the interquartile range of a given object of numerical values.

The interquartile range of these values is a range where 25% on either side is cut off. Statistically, the interquartile range is the difference between the upper quartile and the lower quartile.

Syntax

This widget is not supported in dev-mode. Kindly enable it or run using yarn webapp:dev-widgets.

Parameters

This function takes the following parameter values:

  • x: This represents the numeric vector. This is a required parameter.

  • na.rm: This takes a logical value, TRUE or FALSE, indicating whether missing values be removed or not.

  • type: This represents an integer selecting one of the many quantile algorithms. This is an oprional parameter.

Return value

This method returns the interquartile range of a given object of numerical values.

Example

This widget is not supported in dev-mode. Kindly enable it or run using yarn webapp:dev-widgets.

Explanation

  • Line 2: We create an R object, x, containing numerical values from 0 to 10.

  • Line 5: We implement the IQR() function to determine the interquartile range of the set of numbers and print the result to the console.

Free Resources