top: Gets the largest data points

Description Usage Arguments Author(s) See Also Examples

Description

Gets the n largest data points in a vector, where n can either be a fraction or a number. If n is fraction, at least round(n*length(x)+0.5) values will be found.

Usage

1
2
## Default S3 method:
top(x, n=0.05, na.rm=TRUE, inf.rm=FALSE, ...)

Arguments

x

The vector of data points

n

The number or the fraction of data points to be selected. A value 0<n<1 indicates a fraction. Default value is 0.05, i.e. the top 5% percent.

na.rm

If TRUE all NA and NaN values are omitted.

inf.rm

If TRUE all Inf values are omitted.

...

Not used.

Author(s)

Henrik Bengtsson

See Also

which()

Examples

1
2
  idx <- which(top(1:100, n=0.021))
  print(idx)    # 98 99 100

HenrikBengtsson/R.basic documentation built on May 6, 2019, 11:51 p.m.