# data
n <- 12
f <- sample(c("Group1","Group2"), size=n, replace=TRUE)
x1 <- round(rnorm(n=n, mean=50, sd=10), 2)
x2 <- round(rnorm(n=n, mean=50, sd=10), 2)
x3 <- round(rnorm(n=n, mean=50, sd=10), 2)
x4 <- round(rnorm(n=n, mean=50, sd=10), 2)
d <- data.frame(f,x1, x2, x3, x4)
rm(f); rm(x1); rm(x2); rm(x3); rm(x4)
# correlation and covariance
Correlation(x1, x2)
# short name
cr(x1, x2)
# brief form of output
cr_brief(x1, x2)
# Spearman rank correlation, one-sided test
Correlation(x1, x2, method="spearman", alternative="less")
# correlation matrix of the numerical variables in d assigned to R
R <- Correlation()
# correlation matrix of Kendall's tau coefficients
R <- cr(method="kendall")
# analysis with data not from data frame R
data(attitude)
R <- Correlation(rating, learning, data=attitude)
# analysis of entire data frame that is not R
data(attitude)
R <- Correlation(attitude)
Run the code above in your browser using DataLab