Displaying 1 result from an estimated 1 matches for "1counter2".
Did you mean:
counter2
2008 Feb 29
2
while loop syntax help
...ever, output returns "NULL", no matter how I've modified the syntax.
Thanks in advance for any help.
Zack
#############################
x <- c(5,5,7,6,5,4,3) x <- data.frame(x)
y <-length(x)-2counter <- 1
output = c()
while(counter <= y) {
counter1 <- counter+1counter2 <- counter+2
if(x[counter,1] > x[counter1,1]|| x[counter1,1] > x[counter2,1]){output = x[counter, ]
} else {
counter = counter+1
}
counter = y}########################################
[[alternative HTML version deleted]]