I´m trying to display in a list which tells me column pairs, their correlation and pvalues. Then eliminate those which have a correlation < 0.5 & pvalues > 0.06. Using the next matrix
r <- 33
c <- 6
m0 <- matrix(0, r, c)
matriz<-apply(m0, c(1,2), function(x) sample(c(0,1),1))
cor.m<-cor.prob(matriz)
Then we'll have over the diagonal the pvalues and below the correlation. Using a similar answer I found from Show correlations as an ordered list but I tried to show the pvalues also, without success. Then I tried at least to erase those datas wich have correlation< 0.5 using the following code
cor.m[upper.tri(cor.m,diag=TRUE)]=NA
cor.m<-as.data.frame(as.table(cor.m))
cor.m<-na.omit(cor.m)
cor.m<-cor.m[-c((cor.m$Freq<'0.5')), ] #but this erase no matter the feature
then tried this loop but it generate an error "Error en if (corx1$Freq[i] < 0.2) { waiting for TRUE/FALSE value:" and also changes the column with the pair of data
# then tried this with same results
for (i in 1:nrow(cor.m) ){
if(cor.m$Freq[i]<0.2){
cor.m<- as.data.frame(as.table(cor.m$Freq[-i]))
}
}