Learn R Programming

tsutils (version 0.9.0)

wins: Winsorise

Description

Winsorise either by number or percentage of observations.

Usage

wins(x, p = 0.05)

colWins(x, p = 0.05)

rowWins(x, p = 0.05)

Arguments

x

input data. NAs will be removed.

p

percentage or number of observations to be winsorised. If value is <1 then it is used as a percentages. Otherwise it is the number of observations to winsorise. If the resulting p > floor((length(x)-1)/2), then it is set equal to floor((length(x)-1)/2).

Value

Winsorised vector.

Functions

  • colWins: Vectorised version of wins by columns.

  • rowWins: Vectorised version of wins by rows.

Examples

Run this code
# NOT RUN {
x <- rnorm(100,mean=0,sd=1)
xW <- wins(x)

# }

Run the code above in your browser using DataLab