From db27d8569cc9d16f4eec0115b3cdc2173c353df1 Mon Sep 17 00:00:00 2001 From: fweber144 Date: Mon, 6 Mar 2023 08:53:35 +0100 Subject: [PATCH] In `s()` and `t2()` terms, arguments other than predictors are not allowed, so throw an appropriate error message. This is a follow-up for issue #156 which was only concerned with documentation. However, this still does not address #238 yet (but at least we now throw an appropriate error message). --- R/formula.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/formula.R b/R/formula.R index 3e4cafa13..8cf0aa14b 100644 --- a/R/formula.R +++ b/R/formula.R @@ -108,6 +108,10 @@ parse_additive_terms <- function(terms) { smooth <- unname(unlist(sapply(smooth_terms, function(et) { grep(make_function_regexp(et), terms, value = TRUE) }))) + if (any(grepl("\\(.+,.+=.+\\)", smooth))) { + stop("In s() and t2() terms, arguments other than predictors are not ", + "allowed.") + } return(smooth) }