[R] recoding variables-recode not working

David Winsemius dwinsemius at comcast.net
Wed Apr 7 19:49:33 CEST 2010


On Apr 7, 2010, at 1:31 PM, Vlatka Matkovic Puljic wrote:

> Hi,
>
> I have numerical variable that I want to recode into categories '0'  
> and '1
> and more' and do analysis with that data.
> I have tried various of possibilities to do so, but I am sucked and  
> nothing
> is working.
>
> recode(Q12, "0='A';1:30='B'")
> cut(Q12, breaks=c(0,1,30), lables=c('0', '1 and more'))
> cat(Q12, "0=0;1-33=1")
>
> What should I do to make it right?

What does str(Q12) return?

>
> -- 
> **************************
> Vlatka
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list