[R] upData levels in Hmisc
Tanya Murphy
tmurph6 at po-box.mcgill.ca
Mon May 19 17:50:24 CEST 2003
Dear listserve members, especially Prof. Harrell:
I am trying to create a factor variable that has fewer levels than the
original.
I have a factor:
>rosa$risk1
[1] 2 2 5 1 ...
[1799] 3 3 1 3 1 6 3 3 1 5 3 5 3 3 3 0 3 3 3 1 1 3
Levels: 0 1 2 3 4 5 6 8
But when I do this:
rosa2 <- upData(rosa,
levels=list(risk1=list(1='1',2='2',3='3',0=c('0','4','6','8'))))
I get:
Error: syntax error
But I am able to reproduce the dat2 <- upData(dat, etc...) example in Prof.
Harrell's Hmisc notes.
Thanks!
Tanya Murphy
More information about the R-help
mailing list