I would rather not comment on matlab (where is your matlab code by the way?), but your function could be simplified a bit:
grw.permute <- function(v) { cbind( rep(v, each=length(v)), rep(v, length(v)) ) } > system.time(tmp <- f( 1:300)) user system elapsed 0.020 0.000 0.019 This is on my quite busy 4 years old laptop.... Best, Gabor On Wed, Apr 30, 2008 at 04:15:46PM -0400, Zhandong Liu wrote: > I am switching from Matlab to R, but I found that R is 200 times slower than > matlab. > > Since I am newbie to R, I must be missing some important programming tips. > [...] -- Csardi Gabor <[EMAIL PROTECTED]> UNIL DGM ______________________________________________ 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.