Is there a function in base R, or a more elegant way to detect the step size in a vector increases?
At the moment I am using a combination of diff
and unique
.
xx <- seq(from = 0, to = 100, by = 5)
unique(diff(xx))
# 5
Is there a function in base R, or a more elegant way to detect the step size in a vector increases?
At the moment I am using a combination of diff
and unique
.
xx <- seq(from = 0, to = 100, by = 5)
unique(diff(xx))
# 5