search for: orlibrary

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

Did you mean: rlibrary
2013 Jul 23
0
Function apply
...X<- matrix(sample(1:50,3*140,replace=TRUE),nrow=140) #either res1<-do.call(rbind,lapply(split(as.data.frame(X),((seq_len(nrow(X))-1)%/%10)+1),function(x) apply(x,2,mean))) #or ?res2<-t(sapply(split(as.data.frame(X),((seq_len(nrow(X))-1)%/%10)+1),colMeans)) ?identical(res1,res2) #[1] TRUE #orlibrary(itertools) it<-ihasNext(isplitRows(X,chunkSize=10)) ?while(hasNext(it)){ ?print( apply(nextElem(it),2,mean)) ?} #[1] 23.4 29.1 31.5 #[1] 28.2 21.8 17.2 #[1] 14.3 24.3 36.4 #[1] 22.2 25.2 24.2 #[1] 28.5 22.6 27.3 #[1] 19.6 25.6 20.0 #[1] 25.7 16.3 27.9 #[1] 20.0 24.8 26.7 #[1] 26.3 30.0 33.0 #[1]...