winsorizor: Winsorize at specified percentiles

Description Usage Arguments Value Examples

View source: R/misc.R

Description

Simple function winsorizes data at the specified percentile.

Usage

1
winsorizor(d, percentile, na.rm = TRUE)

Arguments

d

A vector, matrix, or data frame to be winsorized

percentile

The percentile bounded by [0, 1] to winsorize data at

na.rm

A logical whether to remove NAs.

Value

winsorized data. Attributes are included to list the exact values (for each variable, if a data frame or matrix) used to winsorize at the lower and upper ends.

Examples

1
2
3
4
dev.new(width = 10, height = 5)
par(mfrow = c(1, 2))
hist(as.vector(eurodist), main = "Eurodist")
hist(winsorizor(as.vector(eurodist), .05), main = "Eurodist with lower and upper\n5% winsorized")

Example output



pscore documentation built on May 29, 2017, 9:02 a.m.

Related to winsorizor in pscore...