Hello,
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
Dieter Menne wrote:
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).
Thank you, but the regular expression example
sdanzige wrote:
Thank you, but the regular expression example doesn't seem to work
correctly.
I wrote a regular expression that does seem to work, so I'll post it here
for anyone else that needs it.
labs-levels(df$p_bin)
cbind(lower=as.numeric(sub([[(],,sub(,.*,,labs
3 matches
Mail list logo