[R] cut2 once, bin twice...

Dieter Menne dieter.menne at menne-biomed.de
Fri Oct 23 09:58:05 CEST 2009




sdanzige wrote:
> 
> 
> I'm using the Hmisc cut2 function to bin a set of data.  It produces bins
> that I like with results like this:
> 
> [96,270]:171
> [69, 96): 54
> [49, 69): 40
> [35, 49): 28
> [28, 35): 14
> [24, 28):  8
> (Other) : 48
> 
> I would like to take a second set of data, and assign it to bins based on
> factors defined by my call to cut 2.
> 

It used to be quite tricky, but on popular request Brian Ripley has added an
example how to extract the intervals using regular expression on the bottom
of the examples for cut (note:cut in base, not cut2 in Hmisc).

If someone knows of an easier way, please correct me. How about adding this
information as attribute to the standard cut?

Dieter




-- 
View this message in context: http://www.nabble.com/cut2-once%2C-bin-twice...-tp26020736p26022244.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list