Hi All,

I want to do something along the lines of:
for (i in 1:n){
    for (j in 1:n){
        A[i,j]<-myfunc(x[i], x[j])
    }
}

The question is what would be the most efficient way of doing this. Would
using functions such as sapply be more efficient that using a for loop?

Note that n can be a few thousand. Thus atleast a 1000x1000 matrix.

Thanks,
Sachin

        [[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.

Reply via email to