| prettyInt {squash} | R Documentation |
Pretty breakpoints
Description
Compute a sequence of around n values covering the range of x.
These functions are variations of the standard R function pretty.
Usage
prettyInt(x, n = 5, ...)
prettyLog(x, n = 5, small = NA, logrange = c(-100, 100))
Arguments
x |
Numeric vector. |
n |
Approximate number of values to return. |
small |
Value below which distinction from zero is unimportant. |
logrange |
Log (base 10) of the range of values to consider as possible breakpoints. |
... |
Further arguments passed to |
Details
prettyInt returns integer values, even if this forces the number of values returned to be much lower than the requested number n. However, at least two values will be returned.
prettyLog returns values that are approximately evenly spaced on a log scale, such as (1, 3, 10, 30, ...) or (1, 2, 5, 10, 20, 50, ...) or (1, 10, 100, ...).
Negative or zero values in x are accomodated by series such as (-100, -10, -1, 0, 1, 10, 100, ...). Setting the parameter small to a non-NA value will ignore x with absolute values below small.
Value
A numeric vector.
See Also
Examples
##
x1 <- 1:3
pretty(x1)
prettyInt(x1)
prettyLog(x1)
##
x2 <- pi ^ (1:8)
range(x2)
pretty(x2)
prettyLog(x2)
prettyLog(x2, n = 10)
##
x3 <- c(-x2, x2)
pretty(x3)
prettyLog(x3)
prettyLog(x3, small = 100)