I would like to use try()
or tryCatch()
or a function like this to detect if there is an error in my model called "fit1". If the model is fine, I want to use "fit1", otherwise I want to use "fit2"
fit1<-glmer(stat ~ dataint + DBH + DBH2 + (1|site_plot), family=binomial(link="logit"))
fit2<-glm (stat ~ dataint + DBH + DBH2, family=binomial(link="logit"))
Do you know how to do this? I don't add any data because my problem is probably easy to solve, but if it's needed, I can upload them.
THanks!