Re: [R] identifying odd or even number

2014-05-25 Thread arun
Hi Deirdh, You may use ?split() to return a list: x - 51:80 lst1 - lapply(split(seq_along(x), x%%2),function(x1) x[x1]) lst1 #$`0` # [1] 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 #$`1` # [1] 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 sapply(lst1,mean,na.rm=TRUE) # 0  1 #66 65 #odd

[R] identifying odd or even number

2010-07-01 Thread Yemi Oyeyemi
Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. Thanks OYEYEMI, Gafar Matanmi Department of Statistics University of Ilorin P.M.B 1515 Ilorin, Kwara State Nigeria Tel: +2348052278655 Tel: +2348068241885

Re: [R] identifying odd or even number

2010-07-01 Thread Charles C. Berry
On Thu, 1 Jul 2010, Yemi Oyeyemi wrote: Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. Thanks See ?%% example(%%) ?== HTH, Chuck OYEYEMI, Gafar Matanmi [snip] Charles C. Berry

Re: [R] identifying odd or even number

2010-07-01 Thread Marc Schwartz
On Jul 1, 2010, at 10:40 AM, Yemi Oyeyemi wrote: Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. Thanks x - 1:10 x [1] 1 2 3 4 5 6 7 8 9 10 # modulo division x %% 2 == 0 [1] FALSE TRUE FALSE TRUE

Re: [R] identifying odd or even number

2010-07-01 Thread David Winsemius
On Jul 1, 2010, at 11:40 AM, Yemi Oyeyemi wrote: Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. Thanks 1:12 %% 2 == 0 [1] FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE FALSE TRUE OYEYEMI,

Re: [R] identifying odd or even number

2010-07-01 Thread Bernardo Rangel Tura
On Thu, 2010-07-01 at 08:40 -0700, Yemi Oyeyemi wrote: Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. Thanks OYEYEMI, Gafar Matanmi Department of Statistics University of Ilorin Hi Yemi! Your problem is