What's going to be faster, and why?

y <- numeric(0)

z <- c(y, rep(c(TRUE, FALSE), 500000))


z <- numeric(1000000)

z <- rep(c(TRUE, FALSE), 500000)

Why would one prefer one method over the other?

did you run them to see that they are different ?
the last couplet ; the first part of it is irrelevant to the second part, you do not get logicals coerced to numeric because there's no numeric involved.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.