# Summarise Data in R – How to determine pearson spearman correlation in R

Determining the correlation between two variables is a common task in data analysis and statistics. Correlation is a measure of the relationship between two variables and it can be used to understand how changes in one variable are related to changes in another variable.

In R, there are two main ways to determine the correlation between two variables: Pearson correlation and Spearman correlation.

Pearson correlation is a measure of the linear relationship between two variables. It ranges from -1 to 1, where -1 represents a perfect negative correlation, 0 represents no correlation, and 1 represents a perfect positive correlation. The Pearson correlation coefficient can be calculated in R using the cor() function.

Spearman correlation is a non-parametric measure of the rank-based correlation between two variables. It also ranges from -1 to 1, where -1 represents a perfect negative correlation, 0 represents no correlation, and 1 represents a perfect positive correlation. The Spearman correlation coefficient can be calculated in R using the cor(x, y, method = “spearman”) function.

In summary, determining the correlation between two variables is a common task in data analysis and statistics. Correlation is a measure of the relationship between two variables and it can be used to understand how changes in one variable are related to changes in another variable. In R, there are two main ways to determine the correlation between two variables: Pearson correlation and Spearman correlation. Pearson correlation is a measure of the linear relationship between two variables and it can be calculated in R using the cor() function. Spearman correlation is a non-parametric measure of the rank-based correlation between two variables and it can be calculated in R using the cor(x, y, method = “spearman”) function.

In this Applied Machine Learning & Data Science Recipe (Jupyter Notebook), the reader will find the practical use of applied machine learning and data science in R programming: How to determine pearson spearman correlation in R.