# NOT RUN {
## Speed comparison on large matrix.
## ~ 110x speed increase!
# }
# NOT RUN {
MAT <- matrix(rnorm(10 * 500000), ncol = 10)
system.time(RES1 <- apply(MAT, 1, var))
system.time(RES2 <- rowVarsC(MAT))
all.equal(RES1, RES2)
# }
Run the code above in your browser using DataLab