Skip to content

Commit

Permalink
In s() and t2() terms, arguments other than predictors are not al…
Browse files Browse the repository at this point in the history
…lowed,

so throw an appropriate error message.

This is a follow-up for issue stan-dev#156 which was only concerned with documentation.
However, this still does not address stan-dev#238 yet (but at least we now throw an
appropriate error message).
  • Loading branch information
fweber144 committed Mar 6, 2023
1 parent f1c661c commit db27d85
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions R/formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit db27d85

Please sign in to comment.