[BioC] how split a matrix

Ali Mohammadian nrcgeb at gmail.com
Fri Feb 24 14:27:58 CET 2012


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)



More information about the Bioconductor mailing list