Here is an example:
cts<-matrix(sample(1:1000, 600, replace = T), ncol=6)
rownames(cts)<-paste0("Gene", 1:100)
colnames(cts)<-paste0("sample", 1:6)
coldat<-data.frame(B=c(1,2,1,2,1,2),
C=c(1,1,1,2,2,2))
rownames(coldat)<-colnames(cts)
library(DESeq2)
batch="B"
condition="C"
dds <- DESeqDataSetFromMatrix(countData = cts,
colData = coldat,
design= ~ batch + condition)
dds <- DESeq(dds)
Error in DESeqDataSet(se, design = design, ignoreRank) :
all variables in design formula must be columns in colData
My question is how to index batch="B"
and condition="C"
in the design
formula.