Re: [R] List of Variables in Original Order

2012-09-28 Thread rkulp
AK: Thanks, that was very helpful. It led me to think of the function names(base) which provided the vector of names in the correct order. I then used the same matrix formatting and everything worked out exactly as planned. Dick On 9/28/2012 1:09 AM, arun kirshna [via R] wrote: > > > HI, > May

Re: [R] List of Variables in Original Order

2012-09-27 Thread arun
HI, May be this helps you: set.seed(1)  mat1<-matrix(rnorm(60,5),nrow=5,ncol=12) colnames(mat1)<-paste0("Var",1:12) vec2<-format(c(1,cor(mat1[,1],mat1[,2:12])),digits=4) vec3<-colnames(mat1) arr2<-array(rbind(vec3,vec2),dim=c(2,3,4)) res<-data.frame(do.call(rbind,lapply(1:dim(arr2)[3],fun