model1 <- lme(categorical_FOD_FODs~Condition_FODs*Gender_FODs,random=~1|ID/Ch,na.action=na.omit, method = "ML", data=long1.RSPL,control = lmeControl(opt = "optim"))
The model uses the lme function from the nlme package to construct a mixed model. The function will output a model with a random intercept for the subject ID and a random slope for the subject ID and the condition.