Question: how to calculate correlation using r?
Answer: Use the function cor. test(x,y) to analyze the correlation coefficient between two variables and to get significance level of the correlation. Three possible correlation methods using the function cor.test(x,y): pearson, kendall, spearman.