[R] apply with as function ifelse with 2 logical conditions

Nerak nerak.t at hotmail.com
Mon Feb 20 10:40:56 CET 2012

Hi all,
I have a question concerning using several conditions in an ifelse function
used as the function in apply.
I want to create a new value with the  function ifelse ‘ object which can be
coerced to logical mode      “test[n,] >1 & test[n-1,]==0” 
With n I mean the row. I don’t know how I could do this without a loop. I
want to avoid the usage of loops and was thinking about apply. This was what
I was thinking about:



But I get 3 times the amount of rows than that I want… 
what I should achieve:

Has someone a suggestions about what I’m doing wrong?

Many thanks,

View this message in context: http://r.789695.n4.nabble.com/apply-with-as-function-ifelse-with-2-logical-conditions-tp4403637p4403637.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list