[R] Odd and Even

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Apr 6 14:35:55 CEST 2003


Dave Caccace wrote:
> Hi,
> 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.
> Thanks,
> Dave

if(p %% 2) "odd" else "even"

Uwe Ligges



More information about the R-help mailing list