Skip to content
Prev 327716 / 398502 Next

Using If loop in R how to extract even and odd ids

Hello,

Who told you you need a loop or an if?


even <- function(x) x %% 2 == 0

x <- 1:50
idx <- even(x)
x[idx]


Hope this helps,

Rui Barradas

Em 31-07-2013 08:46, ravi.raghava1 escreveu: