I tried your function. It works great thanks. I used then diag() in order to have the value "1" for the whole diagonal of my matrix. But it still doesn't work.... it's crazy. By deleting colums and rows (and so some files) containing only NAs in the correlation matrix, it doesn't work when I apply the function, because I'm working on a list of files. By deleting the files in the correlation matrix, it cannot apply the function on the list.files (dimensions are different if I delete some files in the correlation). And as I don't know before the calculation which files are going to contain these NA columns and rows, I have to do it on another way. I think I should first select the files for my list (and for the correlation) which contains at least for example 1000 numeric values in a certain array in order to calculate my correlations. But i'll post it in another topic.
-- View this message in context: http://r.789695.n4.nabble.com/Prevent-calculation-when-only-NA-tp4630716p4630752.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.