search for: newtemp2

Displaying 1 result from an estimated 1 matches for "newtemp2".

2004 Sep 28
3
sapply behavior
...or me. (I'm using R on Windows XP, either 1.8.0 or 1.9.1) Thanks for any help, Elizabeth Purdom > temp2<-matrix(sample(1:6,6,replace=F),byrow=F,nrow=6,ncol=4) > colnames(temp2)<-paste("A",as.character(1:4),sep="") > temp2<-as.data.frame(temp2) > newtemp2<-sapply((1:6),function(x){xmat<-temp2[temp2[,1]==x,,drop=F];return(xmat[1,])}) > print(newtemp2) #looks like matrix [,1] [,2] [,3] [,4] [,5] [,6] A1 1 2 3 4 5 6 A2 1 2 3 4 5 6 A3 1 2 3 4 5 6 A4 1 2 3 4 5 6 > is.matrix(new...