View source: R/global_processing.R

winsorNorm | R Documentation |

Normalize a numeric vector by rescaling and Winsorizing, i.e. rescale the middle of the data to the range [0, 1] and bound the upper tail to 1 and the lower tail to 0, effectively replacing a fixed amount of extreme values in each tail. Similar to trimming the tails except instead of discarding the tails entirely they're bounded.

```
winsorNorm(x, trim)
```

`x` |
A numeric vector, the data to be normalized |

`trim` |
Numeric, a fraction in [0, 1] specifying how much of the data to bound to 0 (for the lower tail) or 1 (for the upper tail) |

Numeric vector

```
x <- seq(1, 100, by = 1)
x
# Bound the lower and upper 5% of values in the vector
winsorNorm(x, trim = 0.05)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.