correlation | R Documentation |

It obtains the coefficients of correlation and p-value between all the variables of a data table. The methods to apply are Pearson, Spearman , Kendall and lin's concordance index. In case of not specifying the method, the Pearson method will be used. The results are similar to SAS.

```
correlation(x,y=NULL, method = c("pearson", "kendall", "spearman", "lin")
,alternative="two.sided")
```

`x` |
table, matrix or vector |

`y` |
table, matrix or vector |

`method` |
"pearson", "kendall", "spearman", "lin" |

`alternative` |
"two.sided", "less", "greater" |

Parameters equal to function cor()

The correlation matrix with its probability

Felipe de Mendiburu

Lin LI. A concordance correlation coefficient to evaluate reproducibility. Biometrics. 1989; 45, 255-268.

`correl `

```
library(agricolae)
data(soil)
# example 1
analysis<-correlation(soil[,2:8],method="pearson")
analysis
# Example 2: correlation between pH, variable 2 and other elements from soil.
analysis<-with(soil,correlation(pH,soil[,3:8],method="pearson",alternative="less"))
analysis
# Example 3: correlation between pH and clay method kendall.
with(soil,correlation(pH,clay,method="kendall", alternative="two.sided"))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.