correlation {agricolae} | 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 and Kendall. 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") ,alternative="two.sided")
x |
table, matrix or vector |
y |
table, matrix or vector |
method |
"pearson", "kendall", "spearman" |
alternative |
"two.sided", "less", "greater" |
Parameters equal to function cor()
table |
Numeric |
Felipe de Mendiburu
library(agricolae) # example 1 data(soil) analysis<-correlation(soil[,2:8],method="pearson") analysis # Example 2: correlation between pH, variable 2 and other elements from soil. data(soil) attach(soil) analysis<-correlation(pH,soil[,3:8],method="pearson",alternative="less") analysis detach(soil) # Example 3: correlation between pH and clay method kendall. data(soil) attach(soil) correlation(pH,clay,method="kendall", alternative="two.sided") detach(soil)