I have a df with integer values. For purposes of classification, I’d like to replace this df with a simpler one that has pre-determined intervals instead of integers. How do I do this efficiently? An example is below:
df:
1 2 3
1 5 3 0
2 1 10 12
3 3 0 10
transforms into:
1 2 3
1 [3-5] [3-5] [0-2]
2 [0-2] [10-12][10-12]
3 [3-5] [0-2] [10-12]
Is
dfa data frame or a matrix? The name suggests the former, but the way you describe it suggests the latter.If it’s a matrix:
If it’s a data frame: