Quot.Rd
Returns suitably lagged and iterated quotients
Quot(x, lag = 1, quotients = 1, ...)
NA
's propagate.
If x
is a vector of length n
and quotients = 1
,
then the computed result is equal to the successive quotients
x[(1+lag):n] - x[1:(n-lag)]
.
If quotients
is larger than one this algorithm is applied
recursively to x
.
Note that the returned value is a vector which is shorter than
x
.
If x
is a matrix then the division operations are carried out
on each column separately.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Quot(1:10, 2)
#> [1] 3.000000 2.000000 1.666667 1.500000 1.400000 1.333333 1.285714 1.250000
Quot(1:10, 2, 2)
#> [1] 0.5555556 0.7500000 0.8400000 0.8888889 0.9183673 0.9375000
x <- cumprod(cumprod(1:10))
Quot(x, lag = 2)
#> [1] 12 144 2880 86400 3628800
#> [6] 203212800 14631321600 1316818944000
Quot(x, quotients = 2)
#> [1] 3 4 5 6 7 8 9 10