I have a dataset with no age-variable. But I have a variable with a year of birth which I want to use to calculate age. But there is a problem that the year of birth is coded as categorical variable. So, I have codes as 1, 2, 3, etc. And years are given as labels to those codes. Is there any simple way to use these labels as numbers to calculate age in R? Thanks in advance, everyone!
upd. It is impossible to use this variable as.numeric since this way it makes calculations with codes (1, 2, 3, etc.), which is wrong calculation.