Skip to content

Commit

Permalink
Disable I(.) in dynamiteformula, closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
santikka committed May 13, 2022
1 parent 05b19a7 commit 6357dce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions R/dynamiteformula.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dynamiteformula <- function(formula, family) {
family <- eval(family_call$call)
}
}
if (has_as_is(deparse(formula))) {
stop_("The use of I(.) is not supported by dynamiteformula")
}
x <- dynamiteformula_(formula, family)
structure(
list(
Expand Down
6 changes: 3 additions & 3 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ indenter_ <- function(m = 2) {
}
}

#' Check if x is a string of the form I(.)
#' Check if x contains a string of the form I(.)
#'
#' @param x A character string
#'
#' @noRd
is_as_is <- function(x) {
grepl("I\\(.*\\)", x, perl = TRUE)
has_as_is <- function(x) {
grepl("I\\(.+\\)", x, perl = TRUE)
}

#' Stop function execution without displaying the call
Expand Down

0 comments on commit 6357dce

Please sign in to comment.