My dataframe is of the following form:
Index: Number of pets owned : Age range
10 : 30s
2 : 50s
4 : 60s
6 : <20s
9 : 70s
etc. Essentially, the number of age ranges are <20s, 20s, 30s, 40s, 50s, 60s, 70s. What I would like to do is turn this categorical age range variable into a continuous one by assigning 1, 2, 3, 4, 5, 6, 7 to the age ranges. Any idea how I can do this in R? I think the as.numeric function could be useful but I've never used it before.