nicenumbs: Round Nice

Description Usage Arguments Value Examples

View source: R/Round to nice numbers.R

Description

Rounds a number of vector of numbers to a nice perty number for plot axis or whatever else.

Usage

1
2
nicenumbs(x, lower_bound = TRUE, nice_small = c(0, 5, 10), nice_big = c(1,
  2, 3, 4, 5, 6, 7, 8, 9, 10))

Arguments

x

a number or vector

lower_bound

logical to round down(default) or round up

nice_small

a vector scalar for rounding small numbers (<100)

nice_big

a vector scalar for rounding big numbers (>100)

Value

Returns rounded number or vector

Examples

1
2
3
4
5
nicenumbs(c(4,12,233,49488), lower_bound = T)
nicenumbs(c(4,12,233,49488), lower_bound = F)
##You can also input vectors using the vectorize function.
v.nicenumbs <- Vectorize(nicenumbs)
v.nicenumbs(c(2,23,456,777,1001))

wrbrignon/BrignonPackage documentation built on May 4, 2019, 10:54 a.m.