Maturing lifecycle

Change the base year.

rebase(x, n = NULL)

rebase_origin(x)

Arguments

x

[univariate vector]

Univariate vector, numeric or ts object with only one dimension.

n

[numeric(1): NULL]

The index of the new base year.

Value

Returns a vector with the same class and attributes as the input vector.

Examples

x <- 3:10 # New base would be 5 rebase(x, 5)
#> [1] 0.4285714 0.5714286 0.7142857 0.8571429 1.0000000 1.1428571 1.2857143 #> [8] 1.4285714
# Or the origin rebase_origin(x)
#> [1] 1.000000 1.333333 1.666667 2.000000 2.333333 2.666667 3.000000 3.333333
# Fro the base to be 100 or 0 then: rebase(x, 5)*100
#> [1] 42.85714 57.14286 71.42857 85.71429 100.00000 114.28571 128.57143 #> [8] 142.85714
rebase(x, 5) - 1
#> [1] -0.5714286 -0.4285714 -0.2857143 -0.1428571 0.0000000 0.1428571 0.2857143 #> [8] 0.4285714