data(iris)
# pretty range for vectors with decimal points
pretty_range(iris$Petal.Length)
# pretty range for large range, increasing by 50
pretty_range(1:1000)
# increasing by 20
pretty_range(1:1000, n = 7)
# return 10 intervals
pretty_range(1:1000, length = 10)
# same result
pretty_range(1:1000, n = 2.5)
# function factory
range_n_5 <- pretty_range(n = 5)
range_n_5(1:1000)
Run the code above in your browser using DataLab