Description Usage Arguments Details Value Examples
prune returns a pruned numeric vector.
1 2 |
x |
A numeric vector. |
method |
A character string indicating the desired method of pruning
with |
low |
The lower value/percentile for pruning See Details for more information. |
high |
The upper value/percentile for pruning See Details for more information. |
replace |
Either |
prune returns a pruned version of the numeric vector x.
NA values in x are ignored during the pruning process
but are preserved in the output. prune will do one-sided pruning
if only one low or high argument is provided
(e.g. prune(x, low=-1) will prune x at a lower value of -1).
prune is designed to be readable from the function call. For example:
prune(x, "value", low=-1, high=1) can be read as
"prune x at -1 and 1".
prune(x, "percentile", low=.05, high=.95) can be read as
"prune x at the 5th and 95th percentiles".
The arguments low and high are used based on method.
prune offers several different options for method:
value: low and high are used as raw values
(e.g. .05 is the value .05).
percentile: low and high are used as percentiles
(e.g. .05 is 5th percentile).
The output of prune is a pruned numeric vector with the same
length as x.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(51)
x <- rnorm(1e4)
summary(x)
# pruning at the values -1 and 1!
x_val <- prune(x, low=-1, high=1)
summary(x_val)
# pruning at 5th and 95th percentiles!
x_per <- prune(x, "percentile", low=.05, high=.95)
summary(x_per)
# pruning values above the 95th percentile!
x_hi <- prune(x, "percentile", high=.95)
summary(x_hi)
# pruning values converted to NAs!
x_NA <- prune(x, "percentile", low=.05, high=.95, replace=NA)
summary(x_NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.