[R] Odd and Even
spencer.graves at pdf.com
Sun Apr 6 19:20:36 CEST 2003
Or in vector format:
> ifelse(seq(1, 2, length=3) %%2, "odd", "even")
 "odd" "odd" "even"
Uwe Ligges wrote:
> Dave Caccace wrote:
>> I'm trying to create a function, jim(p) which varies
>> depending on whether the value of p is odd or even. I
>> was trying to use th eIf function, but i cant work out
>> a formula to work out if p is odd or even.
> if(p %% 2) "odd" else "even"
> Uwe Ligges
> R-help at stat.math.ethz.ch mailing list
More information about the R-help