trimmer | R Documentation |
Trim a series by some percentage
trimmer(x, prc = 0.1)
x |
series to trim |
prc |
the percentage of data to trim from either side of |
The trimming is done with sort.int
, which may be
problematic for timeseries. The best option is to trim an index series
and use that to re-sample the timeseries. See Examples.
Also sets an attribute 'trim'
with details of the trimming.
# default is a 10% trim trimmer(1:10) # 2 3 4 5 6 7 8 9 # but sort is used... set.seed(1234) x <- round(runif(10, max = 10)) # note order of values trimmer(x) # trimmed, but sorted # we can fix this by trimming an index: x[trimmer(seq_along(x))] # trimmed, with order retained
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.