R/hasRequires.R

Defines functions hasRequires hasRequires.Param hasRequires.ParamSet

Documented in hasRequires

#' @title Check parameter / parameter set for requirements / dependencies.
#'
#' @description
#' `TRUE` iff the parameter has any requirements or any parameter in the set has
#' requirements.
#'
#' @template arg_par_or_set
#' @return `logical(1)`.
#' @export
hasRequires = function(par) {
  UseMethod("hasRequires")
}

#' @export
hasRequires.Param = function(par) {
  return(!is.null(par$requires))
}

#' @export
hasRequires.ParamSet = function(par) {
  return(any(vapply(par$pars, hasRequires, logical(1L))))
}

Try the ParamHelpers package in your browser

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

ParamHelpers documentation built on March 26, 2020, 7:40 p.m.