[R] cut2 once, bin twice...

sdanzige sam.danziger at gmail.com
Fri Oct 23 17:48:45 CEST 2009



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))),
        upper=as.numeric(sub("[])]","",sub("[[(].*, *","",labs))) )


I fear my inelegance will peg me as a Windows programmer, but so be it... 
-S
-- 
View this message in context: http://www.nabble.com/cut2-once%2C-bin-twice...-tp26020736p26028296.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list