I'm trying to use combat to correct for batch effect in our dataset. The sample csv files contains genes in rows, and samples in columns, and expression values are from different microarray. We have in total 6 batches, and the sif file contains 3 columns : arrays, samples, batch (as per the manual). R generates an error message when running combat.. I'm not sure what to do from here. What am I doing wrong?? 




Library(sva)
dat = read.csv("Combat_matrix_input.csv");
sif = read.csv("sif.csv");
modcombat = model.matrix(~1, data=dat)
newdata = ComBat(dat=dat, batch=sif$Batch, par.prior = TRUE, mod = modcombat)
Found 6 batches
Error in cbind(batchmod, mod) :
number of rows of matrices must match (see arg 2)





Library(sva)
dat = read.csv("Combat_matrix_input.csv");
sif = read.csv("sif.csv");
modcombat = model.matrix(~1, data=dat)
newdata = ComBat(dat=dat, batch=sif$Batch, par.prior = TRUE, mod = modcombat)
Found 6 batches
Error in cbind(batchmod, mod) :
number of rows of matrices must match (see arg 2)
Comment