powered by
A function for constructing indices
indConstruct(data, origVar, newVarName = NA, baseYear = 2000)
The indice
The data frame containing the data
The variable in which the indices is to be computed
The name assigned to the new variable, if missing then .SC/.SH/.GR/.CH/.IND will be appended depending on the type of construction.
The year which will serve as the base
test.df = data.frame(FAOST_CODE = rep(1, 100), Year = 1901:2000, test = 1:100) indConstruct(test.df, origVar = "test", baseYear = 1950)
Run the code above in your browser using DataLab