search for: zdifff

Displaying 1 result from an estimated 1 matches for "zdifff".

Did you mean: zdiff
2013 Mar 25
1
Newbie code to count runs of up or down moves
...stakes with this code. I am used to coding in C with a debugger, so I am very new to coding in R without one and different syntax. My code in the upper left panel of R Studio isz<-c(3,1,4,5,2,1,0,3,5,8)zlength(z)y<-c(0,0,0,0,0,0,0,0,0,0)ylength(y)zdiff = diff(z)zdiffn<-length(zdiff)nx<-zdifff<-function(x) { for (k in 1:n){ for (i in 1:n-k){ if (all(x[i] * x[i-1] > 0) && ((x[i+k+1] * x[i+k]) < 0) y[k]<-y[k]+1 } } return(y)}f(x)__________I get back > z [1...