R/check_multiple_dep_and_one_indep.R

Defines functions check_multiple_dep_and_one_indep

check_multiple_dep_and_one_indep <-
  function(data, dep, indep,
           call = rlang::caller_env()) {

    dep_call <- rlang::expr_deparse(rlang::enquo(dep))
    indep_call <- rlang::expr_deparse(rlang::enquo(indep))

    if((ncol(dplyr::select(.data = data, {{dep}})) > 1L &&
        ncol(dplyr::select(.data = data, {{indep}})) >= 1L)) {
      cli::cli_abort(c("Multiple columns for {.arg dep} and {.arg indep} are not allowed.",
                       i="You provided dep = {dep_call} and indep = {indep_call}"),
                     call = call)
    }
  }

Try the saros package in your browser

Any scripts or data that you put into this service are public.

saros documentation built on June 8, 2025, 10:43 a.m.