prettyInt: Pretty breakpoints

Description Usage Arguments Details Value See Also Examples

View source: R/squash.R

Description

Compute a sequence of around n values covering the range of x. These functions are variations of the standard R function pretty.

Usage

1
2
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 pretty.

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

pretty

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
 
##
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)

squash documentation built on Feb. 20, 2020, 9:08 a.m.