Hi,

I don't understand why this doesn't work:

matTest <- matrix(nrow=3, ncol=3)
testMove <- function(I, J){
    for(i in 1:I){
        for(j in 1:J){
            matTest[i, j] <- i+j
        }
    }
}
testMove(2, 3)
matTest

Why the elements of the matrix matTest are still NA?  How could I fix it?

Thanks,
Ken

______________________________________________
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