how to get correlation coefficient from r^2 code example Example: calculate correlation in r cor(x, method = "pearson", use = "complete.obs")