search for: unsmart

Displaying 1 result from an estimated 1 matches for "unsmart".

Did you mean: smart
2011 Aug 31
2
Classifying values by interval
...r X, say with breaks at B = c(b1,b2,...,b11) covering the range of X, i.e. bins numbered 1:10. The value x is in bin i if B[i] < x <= B[i+1] What I seek is a vector, of the same length as X, which for each x in X gives the number of the bin that x is in. Clearly this can be done in an "unsmart" way by looping through all of X along with something like which( (B[1:10] < X[j]) & (X[j] <= B[2:11]) ) However, I feel that this naturally occurring task must have received a smarter solution! The hist() function already does this implicitly, since it has to decide which bin a...