sortAndFilterByCumsumprop: Sort a numeric vector and filter by a threshold of cumsumprop

Description Usage Arguments Value Examples

View source: R/cumsumprop.R

Description

Sort a numeric vector and filter by a threshold of cumsumprop

Usage

1

Arguments

x

Numeric vector, usually named

thr

Threshold, default 0.9, meaning that items whose proportion of cumulative sum just above 0.9 are kept.

Value

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

Examples

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

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.