I have a big dataset with 100 variables and 3000 observations. I want to detect those variables (columns) which are highly correlated or redundant and so remove the dimensonality in the dataframe. I tried this but it calculates only the correlation between one column and the others; and I always get an error message
for(i in 1:ncol(predicteurs)){
correlations <- cor(predicteurs[,i],predicteurs[,2])
names(correlations[which.max(abs(correlations))])
}
Warning messages:
1: In cor(predicteurs[, i], predicteurs[, 2]) :
the standard deviation is zero
2: In cor(predicteurs[, i], predicteurs[, 2]) :
the standard deviation is zero
Can anyone help me?