I want to code a variable in 4 categories. I know that I should use the function cut
, but for many examples that I see I do not understand it.
The variable should encode it into 4 categories:
- The first category would be between its minimum and the first quartile.
- The second between the first quartile and the second.
- The third between the second quartile and the third quartile.
- The fourth between the third quartile and the fourth quartile.
All categories with intervals of the form [A,B]
minus the first that will be [Minimo,Q1]
.
I do not know how to do it. For two days I have been searching, remixing and apart I do not see similar examples.