Displaying 1 result from an estimated 1 matches for "nullx1".
2008 Mar 05
1
FOR LOOP w/IFELSE statement help
...omeone tell me how to add an additional statement to example 2, specifying that if in the loop, the
condition isn't found, then to give the max of the string?
Thanks in advance for any replies
### Example 1 ################### start with test string xx <- c(3,4,5,5,6,7,8,9) result <- NULLx1 <- which.min(x)for(i in x1:(length(x)-1)) {if((x[i] == x[i+1])) result <- c(result, x[i]) # start with min, result = where in string x[i]==x[i+1]} ###Example 2 ####################################x <- c(3,4,5,6,7,8,9,10) result <- NULLx1 <- which.min(x)for(i in x1:(...