[R] mapping a vector into predefined bins
Dr. G. Lawyer
dr.g.lawyer at googlemail.com
Fri Aug 22 15:14:46 CEST 2008
Hi,
I have a mapping M consisting of a vector of bin centers (say 0.01, 0.02,
0.03 ..., 1) with associated values (say "red", "orange", "yellow", ...),
stored as a 2-column matrix with column 1 the bin center and column 2 the
value.
I also have a vector D of data (say 0.9056, 0.4118, 0.2162, ...).
I want to map each datum in D to the value associated with its bin in M (say
0.0111-> red, 0.0198 -> orange, ...) .
Does R have a built-in function for this?
Thanks for tips/suggestions.
+glenn
More information about the R-help
mailing list