If I fit a model with offsets of log-transformed variables specified via stats::offset(), I get a warning for every smooth term that also contains log-transformed variables. I'm not sure that this is actually causing downstream issues, but I think there is potential for them.
The warnings do not occur if I specify the offset via the offset argument of gam() (or bam()).
library(mgcv)
d <- gamSim(n = 100)
d$logz <- runif(100)
# specifying offset via `offset()` produce a warning for each `s(log( ))`
m <- gam(y ~ offset(log(x0)) + s(log(x1)) + s(log(x2)) + log(x3) + s(logz),
data = d)
gratia:::draw.gam(m, parametric = TRUE)
# Warning messages:
# 1: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
# 2: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
# 3: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
gratia:::assemble.gam(m, parametric = TRUE)
# ── Assembly of 4 plots ──
#
# 1. s(log(x1))
# 2. s(log(x2))
# 3. s(logz)
# 4. log(x3)
#
# Warning messages:
# 1: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
# 2: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
# 3: In grep(p.terms[!ind], m.terms[off]) :
# argument 'pattern' has length > 1 and only the first element will be used
# specifying `offset` argument does not produce warnings
m <- gam(y ~ s(log(x1)) + s(log(x2)) + log(x3) + s(logz), data = d, offset = log(x0))
gratia:::draw.gam(m, parametric = TRUE)
gratia:::assemble.gam(m, parametric = TRUE)
# ── Assembly of 2 plots ──
#
# 1. s(log(x1))
# 2. s(log(x2))
The plot produced in all four instances is the same:

If I fit a model with offsets of log-transformed variables specified via
stats::offset(), I get a warning for every smooth term that also contains log-transformed variables. I'm not sure that this is actually causing downstream issues, but I think there is potential for them.The warnings do not occur if I specify the offset via the
offsetargument ofgam()(orbam()).The plot produced in all four instances is the same: