Need some help. My data looks like this:
Identifier Sample1 Sample2 Sample3 ...Sample10
Gene1 10.85 9.33 11.04 ... 10.093
Gene2 5.94 7.95 6.46 ... 6.33
...
Gene99 3.93 4.12 7.86 ... 9.45
Samples 1 to 4 are normal, 5 to 10 are abnormal.
The data is stored in a data frame called DF. Need to create a design matrix using a model.matrix function, the idea is to use this information to fit a linear model to be able to identify the differential genes.
I have no clue how to create the design matrix. I have read the documentation, but it leads me nowhere. The function's syntax doesn't seem to be tailored towards the format that I have.
Any tips are appreciated.
You need something like
disease <- factor(rep(c(1,2),c(4,6)))
levels(disease) <- c("normal","abnormal")
design <- model.matrix(~disease)
Have you tried reading the limma User's Guide? There are heaps of examples: