powered by
Identifies statistical outliers in a numeric variable using the Interquartile Range (IQR) method. Provides detailed diagnostics about the outlier detection process.
find_outliers(data, variable_name, verbose = TRUE)
If outliers are found:
Data frame containing rows with outlier values
Prints diagnostic information about quartiles and fences
If no outliers:
Returns NULL
Prints confirmation message
Data frame containing the variable to analyze.
Unquoted name of the numeric variable to check for outliers.
Logical. If TRUE, prints diagnostic information about quartiles, fences, and number of outliers found. Default is TRUE.
Variable name
Q1 and Q3 values
IQR value
Upper and lower fence values
Number of outliers found
The function uses the standard IQR method for outlier detection:
Calculates Q1 (25th percentile) and Q3 (75th percentile)
Computes IQR = Q3 - Q1
Defines outliers as values outside (Q1 - 1.5IQR, Q3 + 1.5IQR)
data(mtcars) find_outliers(mtcars, mpg) find_outliers(mtcars, wt, verbose = FALSE)
Run the code above in your browser using DataLab