Last chance! 50% off unlimited learning
Sale ends in
Creates an evenly spaced, pretty sequence of numbers for a range of a vector.
pretty_range(x, n = NULL, length = NULL)
A numeric vector.
Numeric value, indicating the size of how many values are used to
create a pretty sequence. If x
has a large value range (> 100),
n
could be something between 1 to 5. If x
has a rather
small amount of unique values, n
could be something between
10 to 20. If n = NULL
, pretty_range()
automatically
tries to find a pretty sequence.
Integer value, as alternative to n
, defines the number of
intervals to be returned.
A numeric vector with a range corresponding to the minimum and maximum
values of x
.
# NOT RUN {
library(sjmisc)
data(efc)
x <- std(efc$c12hour)
x
# pretty range for vectors with decimal points
pretty_range(x)
# 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)
# }
Run the code above in your browser using DataLab