# 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)
# correlation matrix of the numerical variables in mydata
Correlation()
# correlation matrix of specified variables in mydata
Correlation(x1:x3)
# analysis with data not from data frame mydata
data(attitude)
Correlation(rating, learning, dframe=attitude)
# analysis of entire data frame that is not mydata
data(attitude)
Correlation(attitude)
Run the code above in your browser using DataLab