I am relatively new to R and trying to create a new variable as part of a homework assignment, any help would be appreciated!
I have a data set that looks like this:
State agegr
1 15-17
1 18-20
1 21-24
2 15-17
2 18-20
2 21-24
Currently I have state as the ID column, however would like to modify it so that I have a single ID column showing the state and age range, something like this:
State
1-15
1-18
1-21
2-15
2-18
2-21
and be able to identify the state.