Learn R Programming

agricolae (version 1.0-1)

cor.vector: Correlation between two variables

Description

Obtains the correlation coefficient and tests of hypothesis r = 0, by means of the methods of Pearson, Spearman or Kendall. By default is Pearson and alternative two sided. Results similar to SAS.

Usage

cor.vector(x, y, method = c("pearson", "kendall", "spearman")
,alternative="two.sided")

Arguments

x
Vector 1
y
Vector 2
method
"pearson", "kendall", "spearman"
alternative
"two.sided", "less", "greater"

Value

  • xNumeric
  • yNumeric

Details

Parameters equal to function cor()

See Also

cor.matrix, cor.mv, correl

Examples

Run this code
library(agricolae)
data(soil)
# correlation between pH and % clay method kendall.
attach(soil)
pH<-soil[,2] ; clay <- soil[11]
cor.vector(pH,clay,method="kendall", alternative="two.sided")

Run the code above in your browser using DataLab