This function identifies outliers in a specified column of a data frame. It returns a tibble containing the unique values, tally, and whether it is an outlier or not.

identify_outliers(df, var)

Arguments

df

The data frame.

var

The column to check for outliers.

Value

A tibble containing the unique values, tally, and whether each value is an outlier or not.

Examples

df <- data.frame(a = c(1, 2, 3, 100, 101), b = c(4, 5, 6, 7, 8), c = c(7, 8, 9, 100, 101))
outliers <- identify_outliers(df, "a")
print(outliers)
#> # A tibble: 1 × 3
#>   `"a"`     n outlier
#>   <chr> <int> <lgl>  
#> 1 a         5 FALSE