arc | R Documentation |
Calculate annualized rate of change from one vector which includes numeric year and another vector which includes values of some measure for those years.
arc(years, values, denominator = 100)
years |
[ |
values |
[ |
denominator |
[ |
ARC for the period between years i and j is calculated as:
arc[i,j] = 100 * ln(value_j / value_i) / (year_j - year_i)
Index is such that for index i, output[i]
is arc for period years[i - 1]
to years[i]
and the first entry in the output is NA
.
This function does not sort years
so users should check inputs are
ordered correctly.
[numeric()
]
Annualized rate of change for the intervals between elements of years
.
Preston Demography textbook Chapter 1
https://www.un.org/esa/sustdev/natlinfo/indicators/methodology_sheets/demographics/population_growth_rate.pdf
# vectors
arc(years = c(2000, 2005, 2010), values = c(10, 20, 25))
# data.table
library(data.table)
dt <- data.table(
year = c(2000, 2005, 2010),
val = c(10, 20, 25)
)
dt[, arc := arc(years = year, values = val)]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.