[R] Equivalent for Matematica function Which...

Jarek Jasiewicz jarekj at amu.edu.pl
Tue Sep 29 20:11:20 CEST 2009


Dear All!

I'm looking for equivalent of Matematica function "Which" which works as 
follows:

z = Which[x<10,0.3, 10<=x<20,0.5, 20<=x<100,1]

where x is a vector

I can replace it with custom function with set of ifelse but I'm looking 
for simpler and faster (much faster) solution

best wishes
Jarek




More information about the R-help mailing list