cor function - RDocumentation
www.rdocumentation.org › versions › 3Note that "spearman" basically computes cor (R (x), R (y)) (or cov (., .)) where R (u) := rank (u, na.last = "keep"). In the case of missing values, the ranks are calculated depending on the value of use, either based on complete observations, or based on pairwise completeness with reranking for each pair.
Pairwise-complete correlation considered dangerous
http://bwlewis.github.io › missingThe cov and cor functions in the R programming language include several options ... (x = matrix(c(-2,-1,0,1,2,1.5,2,0,1,2,NA,NA,0,1,2),5))
Correlation in R - DataScience Made Simple
www.datasciencemadesimple.com › correlation-in-rCorrelation of vector in R with NA: Note: Correlation in R cannot be calculated if values has NA. So use = “complete.obs” neglects NAs while calculating correlation coefficient in R # correlation in R : handling NA x <- c(0,1,1,2,3,5,8,13,21,NA) y <- log(x+1) cor(x,y,use = "complete.obs") so the output will be