Description Usage Arguments Value Examples
Sort a numeric vector and filter by a threshold of cumsumprop
1 | sortAndFilterByCumsumprop(x, thr = 0.9)
|
x |
Numeric vector, usually named |
thr |
Threshold, default 0.9, meaning that items whose proportion of cumulative sum just above 0.9 are kept. |
Another numeric vector, likely shorter than x, items whose
cumsumprop
is equal or lower than thr
. The rest items are
summed into one new item, with the name rest
This function can be useful to extract from a long numeric vector the largest items that dominate the sum of the vector
1 2 | x <- c("A"=1,"B"=2,"C"=3,"D"=4,"E"=400,"F"=500)
sortAndFilterByCumsumprop(x, thr=0.99) ## F and E should be returned
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.