Skip to content
Prev 59969 / 398502 Next

Correct Syntax for a Loop

On 28-Nov-04 ebashi wrote:
In this sort of case you can do it without a loop. The
following code (which as written is specific to the precise
question you have asked) is the sort of thing you can use:

  n<-length(x.dif)
  y2<-x.dif[4:n]
  y0<-x.dif[2:(n-2)]
  y1<-x.dif[1:(n-3)]
  which((y1<=0)&(y0>0)&(y2>0))+3

Hoping this helps,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 28-Nov-04                                       Time: 12:10:00
------------------------------ XFMail ------------------------------