In GNU R, I wish to create an array of strings from an array of numbers in which I categorise number intervals. For example:
x <- c(1:6)
The new array shall categorise number intervals as for example:
x <= 2 --> "Category A"
x > 2 & x <= 5 --> "Category B"
x > 5 -- > "Category C"
So that the new array takes the form of:
x1
[1] "A" "A" "B" "B" "B" "C"
How do I do this?