Hi, I'm trying to make some changes in a vector according to some conditions. It takes too long time however with vector length > 100000 and I guess a better way would be using the apply function. I cannot sort out how, however. As a for/if loop: for (i in 1:length(PrH)) { if (is.finite(PrH[i]) == F & tempHER > tempSPR) {PrH[i] <- 1 } if (is.finite(PrH[i]) == F & tempHER < tempSPR) {PrH[i] <- 0 }} PrH, tempSPR and tempHER are equally long vectors. Thanks in advance!Jonas
[[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.