Entering edit mode
Ali Mohammadian
▴
290
@ali-mohammadian-5008
Last seen 10.2 years ago
Hi Sirs,
I have a matrix, and I have written a function to split it by its
columns, the algorithm works manually, but does not work in R:
A= matrix (rnorm (96),8,12)
get.replicates = function (A, reps=reps){
temp = array(-999,dim=c(dim (A) [2]/reps,dim(A) [1],reps))
for replicates.no in 1: (dim (A) [2]/reps)) {
temp [replicates.no, , ] = A [ , reps*replicates.no-1)+1:
reps*replicates.no) ]
}
temp
}
get.replicates (A,3)