correlation matrix in r
# Step 1: Create a sample data frame (replace this with your own dataset)
set.seed(123)
data <- data.frame(
Var1 = rnorm(100),
Var2 = rnorm(100),
Var3 = rnorm(100)
)
# Step 2: Calculate the correlation matrix
cor_matrix <- cor(data)
# Step 3: Print the correlation matrix
print(cor_matrix)