It seems generally okay. For the contrast, you may want to instead use:

contrast <- makeContrasts(
  smoking = smoking_primary1 - smoking_primary0, 
  levels = design)

That is, we assign a name, smoking, to the contrast, and we make 1 the numerator and 0 the denominator (for fold change derivation).

Later when you run topTable(), I am of the belief that it is 'safer' to refer to coefficients by name; so, you'd use:

DMPs <- topTable(fit2, num = Inf, coef="smoking", genelist = ann450kSub)


With regard to covariates, these are added when you create the design:

design <- model.matrix(~0 + smoking_primary + BMI + sex + income)

Then, to adjust for these, you simply derive test statistics for smoking_primary as you did previously. The inner workings of limma will do the remainder (the adjustment(s) for covariates) for you.


Source link