# NOT RUN {
pretty(1:15) # 0 2 4 6 8 10 12 14 16
pretty(1:15, h = 2) # 0 5 10 15
pretty(1:15, n = 4) # 0 5 10 15
pretty(1:15 * 2) # 0 5 10 15 20 25 30
pretty(1:20) # 0 5 10 15 20
pretty(1:20, n = 2) # 0 10 20
pretty(1:20, n = 10) # 0 2 4 ... 20
for(k in 5:11) {
cat("k=", k, ": "); print(diff(range(pretty(100 + c(0, pi*10^-k)))))}
##-- more bizarre, when min(x) == max(x):
pretty(pi)
add.names <- function(v) { names(v) <- paste(v); v}
utils::str(lapply(add.names(-10:20), pretty))
utils::str(lapply(add.names(0:20), pretty, min.n = 0))
sapply( add.names(0:20), pretty, min.n = 4)
pretty(1.234e100)
pretty(1001.1001)
pretty(1001.1001, shrink = 0.2)
for(k in -7:3)
cat("shrink=", formatC(2^k, width = 9),":",
formatC(pretty(1001.1001, shrink.sml = 2^k), width = 6),"\n")
# }
Run the code above in your browser using DataLab