There you go,  solving his homework again...

>
> Hi,
>
> anyone here who knows how to determine if an integer is "odd" or
> "even" in
> R?
> Thanks.

 > 2 %% 2 == 0
[1] TRUE
 > 3 %% 2 == 0
[1] FALSE is.even <- function(x){ x %% 2 == 0 }

 > is.even(2)
[1] TRUE

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to