Re: [R] another question: how to delete one of columes in two ones with high correlation(0.95)

2009-11-07 Thread bbslover
thank you. I need learn it, after that, maybe I can understant it well. thank Nikhil Nikhil Kaza-2 wrote: You need dim(cor.matrix)[1] Following might be better instead of a loop, to to get the row ids of a matrix (which(cor.matrix =0.95) %/% dim(cor.matrix)[1])+1 for column ids

[R] another question: how to delete one of columes in two ones with high correlation(0.95)

2009-11-06 Thread bbslover
my programe is below: a=c(1,2,1,1,1); b=c(1,2,3,4,1); c=c(3,4,3,3,3); d=c(1,2,3,5,1); e=c(1,5,3,5,1) data.f=data.frame(a,b,c,d,e) origin.data-data.f cor.matrix-cor(origin.data) origin.cor-cor.matrix m-0 for(i in 1:(cor.matrix[1]-1)) { for(j in (i+1):(cor.matrix[2])) { if