Adjusting for time in linear mixed models with R lmer I have a dataset with repeated measures and want to analyze the effect of variable A on variable B while controlling for the effect of time. Measurements are repeated. I am not interested in the effect of time at all.
Should I include time (0,1,2) as a fixed effect like this:
lmer(variable B ~ Variable A + time + (1 | id), data = df)

in order to ensure that R knows I am having 3 repeated measurements?

No, if you are not interested in estimating differences between the levels of time, or if you think the model is better without time, you can safely omit it. By safely I mean that specifying (1 | id) is enough for telling lmer that you have repeated measures for each unit and that you wish to fit a model with a random effect for each statistical unit.
Be careful, however. time is a covariate and omitting it from the model a priori entails making an ad-hoc model selection. A principled way is to look at its overall effect, i.e. by applying the anova command to the model with time and the model without time. Sometimes, extra covariates even though not significant may be helpful to get normal-looking residuals.
If you want to dig deeper into mixed models I suggest you look at Pinheiro and Bates Mixed-Effects Models in S and S-PLUS, Springer, 2000.
