cormat <- cor(iris[, -5])
# set missing
cormat[cbind(c(1,2), c(2,1))] <- NA
# print
cormat
# return complete
corOK(cormat)
# using maximum iterations
corOK(cormat, maxiter=0)
# clean up
rm(cormat)
Run the code above in your browser using DataLab