Learn R Programming

ChemoSpec (version 4.0.1)

chooseLvls: Select Levels for Contour and Image Type Plots

Description

Given a matrix, this function will assist in selecting levels for preparing contour and image type plots. For instance, levels can be spaced evenly, logrithmically, or exponentially.

Usage

chooseLvls(M, n = 10, mode = "even", lambda = 1, base = 2, showHist = FALSE, ...)

Arguments

M
A numeric matrix.
n
For all methods except ecdf, an integer giving the number of levels desired. For ecdf, n should be one or more values in the interval (0...1). For instance, a value of 0.6 corresponds to a single level in which 60
mode
Character. One of c("even", "log", "exp", "ecdf", "posexp", "negexp", "poslog", "neglog"). "even" will create evenly spaced levels. "log" will create levels which are more closely spaced at the extremes, while
lambda
Numeric. A non-zero exponent used with method = "exp" and relatives.
base
Integer. The base used with method = "log" and relatives.
showHist
Logical. Shall a histogram be drawn showing the location of the chosen levels?
...
Arguments to be passed downstream.

Value

  • A numeric vector giving the levels.

References

https://github.com/bryanhanson/ChemoSpec

Examples

Run this code
set.seed(9)
MM <- matrix(runif(100, -1, 1), nrow = 10) # test data
tsts <- c("even", "log", "exp", "ecdf", "poslog", "posexp")
for (i in 1:length(tsts)) {
	nl <- 10
	if(tsts[i] == "ecdf")  nl <- seq(0.1, 0.9, 0.1)
	levels <- chooseLvls(M = MM, n = nl, mode = tsts[i], showHist = TRUE)
	}

Run the code above in your browser using DataLab