[R] More efficient way to use ifelse()?

2010-05-25 Thread Ian Dworkin
O", "Mw", "Ng"), c(2169, 1121, 500, 2500, 625, 300), c(NA, NA, NA, NA, NA, NA)) # It makes sense to me why this does not work (elevation.take.2), but I am not sure how to get it to work. Any suggestions? I suspect it involves a trick using "any" or "II&quo

Re: [R] More efficient way to use ifelse()? - A follow up

2010-05-26 Thread Ian Dworkin
factor.result=F) ) # ~ 3.5s elapsed # David Winsemius suggests system.time( elevation.DW <- (Population=="CO")* 2169+ (Population=="CN")* 1121+ (Population=="Ga")* 500+ (Population=="KO")* 2500+ (Popula