sdanzige wrote:
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
You can also use the onlycuts=TRUE option to cut2 to get the vector of
cut points, although they are not arranged as a vector of lower and a
vector of upper values. It would be easy to customize cut2 to do that.
Frank
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.