My question is about renaming multiple column names at once.
I have a dataframe called 'growth' with 46 columns.
Columns 2:46 are all named as dates, but all of the dates have an X in front of them, e.g. 'X1981'.
Naturally I want to remove the X from all of the column names.
I cannot understand why the following is not working:
colnames(growth[ ,2:length(growth)]) <- substring(colnames(growth[ ,2:length(growth)]),2)
Please help me with some insights.