# NOT RUN {
# 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)
mydata <- 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 mycor
mycor <- Correlation()
# correlation matrix of Kendall's tau coefficients
mycor <- cr(method="kendall")
# correlation matrix of specified variables in mycor with graphics
mycor <- Correlation(x1:x3, graphics=TRUE)
# analysis with data not from data frame mycor
data(attitude)
mycor <- Correlation(rating, learning, data=attitude)
# analysis of entire data frame that is not mycor
data(attitude)
mycor <- Correlation(attitude)
# }
Run the code above in your browser using DataLab