[R] mapping a vector into predefined bins
Wolfgang Huber
huber at ebi.ac.uk
Fri Aug 22 17:59:01 CEST 2008
Have a look at
? cut
Best wishes
Wolfgang
------------------------------------------------------------------
Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber
22/08/2008 14:14 Dr. G. Lawyer scripsit
> 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