I use the following method to calculate a correlation of my dataset:
cor( var1, var2, method = \"method\")
But I like to create a correlation m
You can also calculate correlations for all variables but exclude selected ones, for example:
mtcars <- data.frame(mtcars)
# here we exclude gear and carb variables
cors <- cor(subset(mtcars, select = c(-gear,-carb)))
Also, to calculate correlation between each variable and one column you can use sapply()
# sapply effectively calls the corelation function for each column of mtcars and mtcars$mpg
cors2 <- sapply(mtcars, cor, y=mtcars$mpg)