Learn R Programming

beezdemand (version 0.2.0)

RecodeOutliers: Recode Outliers

Description

Recodes outliers

Usage

RecodeOutliers(df, outval = 3.29, unitshigher = 0)

Value

Invisibly, a dataframe with original and recoded (if any) values

Arguments

df

A dataframe of consumption values

outval

Values greater/less than or equal to this number (specified in standard deviations) will be recoded. Default is 3.29SD as specified by Tabachnick and Fidell (2013)

unitshigher

Outliers identified by outval will be coded to a certain number of units higher/lower than the greatest nonoutlier value. Default is 0 units.

Author

Brent Kaplan bkaplan.ku@gmail.com

Details

Recodes outliers using Tabachnick and Fidell's (2013) criteria. A variable is standardized and values that are greater/less than or equal to a specified outlier value (specified in standard deviations; default 3.29SD) are recoded to a certain number of units (default 0) higher/lower than the greatest nonoutlier value. Disregards 'NA' values.

Examples

Run this code
## If any outliers are detected, they would be coded as 1 unit higher
# \donttest{
emp <- GetEmpirical(apt)
RecodeOutliers(emp[, c(2:6)], unitshigher = 1)
# }

Run the code above in your browser using DataLab