Description Usage Arguments Details Value Author(s)
stratify x into 0,1, based on a percentile or a threshold
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | stratify(x, percentile, threshold, as.factor = FALSE)
## S4 method for signature 'numeric,numeric,missing,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'numeric,missing,numeric,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'numeric,numeric,numeric,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'matrix,numeric,missing,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'matrix,missing,numeric,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'matrix,numeric,numeric,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'data.frame,ANY,ANY,logicalORmissing'
stratify(x, percentile,
threshold, as.factor = FALSE)
## S4 method for signature 'list,ANY,ANY,logicalORmissing'
stratify(x, percentile, threshold,
as.factor = FALSE)
## S4 method for signature 'ANY,missing,missing,missing'
stratify(x, percentile, threshold,
as.factor = FALSE)
|
x |
a numeric |
percentile |
numeric: The percentile at which to cut the data, in the range (0,1). Eg
75th percentile = 0.75
If |
threshold |
numeric: The numeric threshold at which to cut the data. This should
not be |
as.factor |
logical: controls whether the return value should be a factor or not. |
This was designed to convert continuous data (eg gene expression levels)
and discretize into low/high as 0/1, respectively. These data can be a simple
vector, or 2D matrix or data.frame, or a list where each element
is a numeric(1). You can stratify that data using either a percentile,
eg 0.25 or 0.5 for the 25th and 50th percentile; or a threshold, eg 6.5.
If your data is 1D, then you should supply either a single percentile or threshold.
If you have 2D data, then you can provide
a single percentile or threshold, or 1 percentile or threshold for each row in x. these
values are recycled if necessary to match nrow(x).
If you supply both percentile and threshold, then the percentile will be used.
If you supply neither, then percentile=0.5 is used.
a numeric vector, matrix, data.frame or list of 0/1 values, where 0 means below the
cutpoint, and 1 means >= the cutpoint.
Mark Cowley, 2011-09-01
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.