I have a tree list with diameters for each tree (among many other variables). I'm trying to streamline the process of adding a new column that gives a diameter class based on each tree's diameter and I think it can be done with indexing and/or a for loop but I'm not strong with either of these skills. Diameters range from 0-80 cm. I want to put these into 2-cm classes where a tree between 0-0.9 is class "0", a tree 1.0-2.9 is class "2", a tree 3-4.9 is class "4" etc all the way to 80 cm. Here is a small snapshot of my data:
Unit Plot Treatment Year Species2 DBHmet
2 1 1 WB Post-treatment PIPO 42.164
3 1 1 WB Post-treatment PIPO 24.384
4 1 1 WB Post-treatment PIPO 16.764
5 1 1 WB Post-treatment PIPO 23.114
6 1 1 WB Post-treatment PIPO 41.148
7 1 1 WB Post-treatment PIPO 4.826
8 1 1 WB Post-treatment PIPO 17.780
10 1 1 WB Pre-harvest PIPO 11.176
11 1 1 WB Pre-harvest PIPO 42.164
12 1 1 WB Pre-harvest PIPO 3.302
13 1 1 WB Pre-harvest PIPO 12.192
How can I quickly add an additional column that places the "DBHmet" into 2cm classes, as described above?