Pretty breaks. Uses default R break algorithm as implemented in pretty().

pretty_breaks(n = 5, ...)

Arguments

n

desired number of breaks

...

other arguments passed on to pretty()

Examples

pretty_breaks()(1:10)
#> [1] 0 2 4 6 8 10
pretty_breaks()(1:100)
#> [1] 0 20 40 60 80 100
pretty_breaks()(as.Date(c("2008-01-01", "2009-01-01")))
#> Jan 2008 Apr 2008 Jul 2008 Oct 2008 Jan 2009 #> "2008-01-01" "2008-04-01" "2008-07-01" "2008-10-01" "2009-01-01"
pretty_breaks()(as.Date(c("2008-01-01", "2090-01-01")))
#> 2000 2020 2040 2060 2080 2100 #> "2000-01-01" "2020-01-01" "2040-01-01" "2060-01-01" "2080-01-01" "2100-01-01"