powered by
Calculates the differences between consecutive values in a numeric vector.
growth(x, round = c("round", "ceiling", "floor"), digits = 0, init = x[1])
A numeric vector the same length as x.
x
A numeric vector.
One of "round" (invokes round on x before calculation), "ceiling" (calling ceiling), or "floor" (calling floor instead of round, respectively).
"round"
round
"ceiling"
ceiling
"floor"
floor
Integer, passed to round if round="round".
round="round"
Numeric, the initial value to compare the first element of x to.
growth(c(1,10,12,15,122))
Run the code above in your browser using DataLab