Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

threshrank

Thresholded rank transformation.


Description

The lowest thresh values in x all get the value 'thresh'.

Usage

threshrank(x, thresh, keep0s=FALSE, ...)

Arguments

x

(Required). Numeric vector to transform.

thresh

A single numeric value giving the threshold.

keep0s

A logical determining whether 0's in x should remain a zero-value in the output. If FALSE, zeros are treated as any other value.

...

Further arguments passes to the rank function.

Value

A ranked, (optionally) thresholded numeric vector with length equal to x. Default arguments to rank are used, unless provided as additional arguments.

See Also

Examples

#
(a_vector <- sample(0:10, 100, TRUE))
threshrank(a_vector, 5, keep0s=TRUE)
data(GlobalPatterns)
GP <- GlobalPatterns
## These three approaches result in identical otu_table
(x1 <- transform_sample_counts( otu_table(GP), threshrankfun(500)) )
(x2 <- otu_table(apply(otu_table(GP), 2, threshrankfun(500)), taxa_are_rows(GP)) )
identical(x1, x2)
(x3 <- otu_table(apply(otu_table(GP), 2, threshrank, thresh=500), taxa_are_rows(GP)) )
identical(x1, x3)

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.