I am working with proteomics data using Limma. I am having trouble getting my design matrix to recognize the different levels of my factors. The factors of my metadata are set up as follows:
tissue <- factor(field.order$Tissue, levels = c("A", "G", "H"))
timepoint <- factor(field.order$Timepoint, levels = c("t1", "t2", "t3", "t4"))
group <- factor(field.order$Group, levels = c("Exposed", "Unexposed"))
year <- factor(field.order$Year, levels = c("2020", "2021"))
I have four factors, where tissue has 3 levels, timepoint has 4 levels, group has 2 levels, and year has 2 levels. My design matrix is as follows:
desMat <- model.matrix(~ 0 + factor(Tissue, levels = c("A", "G", "H")) + factor(Timepoint, levels = c("t1", "t2", "t3", "t4")) + factor(Group, levels = c("Unexposed", "Exposed")) + factor(Year, levels = c("2020", "2021")) + Injection.order, field.order)
I have tried multiple approaches to have R recognize each level, such as moving the factors around in the design matrix and moving the levels around. No matter what I do nothing changes. R wants to set the first level as what seems to be the "reference" and only lists all the levels of the first factor mentioned in the design matrix.
Therefore, not all levels are found in my design matrix and I am unable to make the proper contrasts.
Does anyone have an idea on how to fix this issue?