coefficient of correlation using r for simple linear regression code example Example: calculate correlation in r cor(x, method = "pearson", use = "complete.obs")