[R] conditional coding question

haps halptekin at gmail.com
Thu Nov 8 18:14:56 CET 2012


Thank you all very much for your helpful comments and showing where I went
wrong. After so many trials, the code below seems to work:
incorp <- with(data7.13.11, 
                   ifelse(groupinc %in% c(5), 'cons', 
                          ifelse(groupinc %in% c(-3,-2) & indinc < 9,
'ethnat', 
                                 ifelse(groupinc %in% c(1,2,3,4) & indinc >
8, 'libmul', 
                                        ifelse(groupinc %in% c(-2,-1) &
indinc > 8, 'civic', 
                                               NA)))))

Let me know if it's just an illusion on my part




--
View this message in context: http://r.789695.n4.nabble.com/conditional-coding-question-tp4648801p4648915.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list