Learn R Programming

tsutils (version 0.9.4)

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)

Value

Winsorised vector.

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).

Functions

  • colWins(): Vectorised version of wins by columns.

  • rowWins(): Vectorised version of wins by rows.

Author

Nikolaos Kourentzes, nikolaos@kourentzes.com.

Examples

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

Run the code above in your browser using DataLab