I believe the issue is in the new call object definition
call <- paste(deparse(model$formula), collapse = "")
Here is an example
library(nlme)
model <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1|Subject)
call <- paste(deparse(model$formula), collapse = "") #New
call
call <- paste(deparse(summary(model)$call),collapse="") #Original
call
I believe the issue is in the new call object definition call <- paste(deparse(model$formula), collapse = "")
Here is an example library(nlme) model <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1|Subject) call <- paste(deparse(model$formula), collapse = "") #New call call <- paste(deparse(summary(model)$call),collapse="") #Original call