pretty2 {berryFunctions} | R Documentation |
pretty
with no values outside of x range
pretty2(x, n = 5, force = FALSE, ...)
x |
object with numeric values |
n |
desired number of values in |
force |
Must output length equal n exactly? DEFAULT: FALSE |
... |
all other arguments in |
calculates pretty(x)
, then removes the values that do not lie within
range(x)
.
If force=TRUE, range(x) is reduced step by step
in a while loop until the condition is met. This is useful if you want
exactly 2 labels on an axis
. In order not to get stuck, the
outer values are taken if there are more than n values within range(x).
Berry Boessenkool, berry-b@gmx.de, Aug 2014
k <- c(135, 155, 120, 105, 140, 130, 190, 110)
range(k)
pretty(k)
pretty2(k)
pretty(c(0.2, 0.9), n=2)
pretty2(c(0.2, 0.9), n=2)
pretty2(c(0.2, 0.9), n=2, force=TRUE)