I am working within a for loop with index j in 1:N and I also have a sample v <- sample(1:N,n,F). I'm looking for some sort of if else statement that works this way:
for(j in 1:N){
if(j in v){
...
}else{ ... }
The problem with this is that if doesn't work with in. Also I need to work with j in a chronological way therefore I can't work with two different loops, one for j in 1:N and another for j in v.
Aucun commentaire:
Enregistrer un commentaire