Displaying 1 result from an estimated 1 matches for "statementto".
Did you mean:
statement
2007 Sep 04
2
For loop with if else statement
Hi,
I try to make a simple for loop with a if else statement (First example - Below) and extend it to a more complex loop (Second example). However, my results
#First example:
x=c(1,2)
t=for(i in 1:length(x)){
if (x==1){a=x+1}else
if (x==2){a=x}
}
Returned from R:
Warning messages:
1: the condition has length > 1 and only the first element will be used in: if (x == 1) {
2: the condition has