I currently have a data frame in r where one column contains values from 1-20. I need to replace values 0-4 -> A, 5-9 -> B, 10-14 -> C.... and so on. What would be the best way to accomplish this?
This is what the first part of the data frame currently looks like:
sex length diameter height wholeWeight shuckedWeight visceraWeight shellWeight rings
1 2 0.455 0.365 0.095 0.5140 0.2245 0.1010 0.1500 15
2 2 0.350 0.265 0.090 0.2255 0.0995 0.0485 0.0700 7
3 1 0.530 0.420 0.135 0.6770 0.2565 0.1415 0.2100 9
4 2 0.440 0.365 0.125 0.5160 0.2155 0.1140 0.1550 10
5 0 0.330 0.255 0.080 0.2050 0.0895 0.0395 0.0550 7
6 0 0.425 0.300 0.095 0.3515 0.1410 0.0775 0.1200 8
7 1 0.530 0.415 0.150 0.7775 0.2370 0.1415 0.3300 20
8 1 0.545 0.425 0.125 0.7680 0.2940 0.1495 0.2600 16
9 2 0.475 0.370 0.125 0.5095 0.2165 0.1125 0.1650 9
10 1 0.550 0.440 0.150 0.8945 0.3145 0.1510 0.3200 19
11 1 0.525 0.380 0.140 0.6065 0.1940 0.1475 0.2100 14
12 2 0.430 0.350 0.110 0.4060 0.1675 0.0810 0.1350 10
I'm trying to replace the values in rings.