I think I need a hint here I am confused right now. I want to create a Differential Expression Analysis comparing Male to Female via Limma. But I also want to adjust the model for e.g. Age, sample site.
Now when I create the Contrast matrix it asks for the design, which includes all my variables. Please find some code below:
> design = model.matrix( ~ AGE + SAMPLE.SITE + DIAGNOSIS + SEX, > metadata)
Now I try to do the contrasts I am interested in with
> contrasts <- makeContrasts("M-F",levels=design)
It gives me the error:
Error in makeContrasts("M-F", levels = design) : The levels must by syntactically valid names in R, see help(make.names). Non-valid names: AGE.GROUPAbove 70,AGE.GROUPUnder 50 In addition: Warning message: In makeContrasts("M-F", levels = design) : Renaming (Intercept) to Intercept
Not sure what I am doing wrong. Any hint very appreciated!
Maybe I dont even need to do a contrast matrix? Maybe I can get the result just with
> result <- topTable(fit, number = 50, adjust = "BH", p.value = 0.05, > lfc = 1.2, coef = "SEXM")
Sex only has M or F.