Closed HelloMckenna closed 1 year ago
Hi, this is tricky, since the error comes from the R language internals in a way that's difficult to detect. In fact, the error here is thrown by code that was intended to give a more informative error message, but it failed to construct the error message string, due to the error it was trying to report!
Can you supply the "traceback()" output to more easily pinpoint the call structure and error location?
Certainly
traceback() 10: paste("\n\tModel [", model, "] is not of type character()\n", sep = "") 9: stop(paste("\n\tModel [", model, "] is not of type character()\n", sep = "")) 8: inla.is.model(model, "latent", stop.on.error = TRUE) 7: INLA::f(xxx, ..., group = group, model = model) 6: g(mySmooth, map = coordinates, model = matern) at
#1 5: eval(expr, envir, enclos) 4: eval(parse(text = lb), envir = env) 3: make.model(components) 2: like("cp", formula = formula, data = data, samplers = samplers, components = components, E = E, ips = ips, domain = domain) 1: lgcp(cmp, Points, samplers = boundary)
The error message is generated inside the INLA package itself; what’s your OS, R version, and
package.version(“inlabru”)
and package.version(“INLA”)
?
Hello inlabru,
I'm trying to run a demo example with my own data and kept getting error:
Error in paste("\n\tModel [", model, "] is not of type character()\n", : cannot coerce type 'closure' to vector of type 'character'
Would it be possible for inlabru to print a more useful error message? I figured out that I was getting this error due to not defining the matern model before making it part of the components:
cmp <- coordinates ~ mySmooth(map = coordinates, model = matern) + Intercept
which then throws the error when running
fit <- lgcp(cmp, Points, samplers = boundary)
This example below will throw the error.