I'm trying to implement a categorization of a continuous variable into a categorical one, based on its interval within a dataframe in R.
My dataframe is shown below:
WIND_SPEED | KWH |
---|---|
2.20 | 2000 |
3.30 | 4000 |
1.30 | 100 |
4.20 | 7000 |
So here is what I'd like to have: if the interval is from
- [0-1) -> 1
- [1-2) -> 2
- [2-3) -> 3
- and so on...
So getting the minimum value and the maximum the categorization should be increased by one for each interval that is of length one.
How can I achieve that in R?