[R] element wise conditional assignment in r

yunjiangster yunjiangster at gmail.com
Sat Oct 2 00:42:45 CEST 2010


 Phil,
  That's very elegant, and certainly solves my problem. But in order to
assign the value to v, I would do v=ifelse(r==1,v-1,v). Is it possible to do
the assignment inside the conditional? That way I can save some running time
of assigning v to itself. Thanks for your solution!

  Sincerely,
  John
-- 
View this message in context: http://r.789695.n4.nabble.com/element-wise-conditional-assignment-in-r-tp2951963p2952010.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list