R/step_check_spacing.R

#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#
# Check if the spacing of a regressor is constant ------------------------------
#
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StepCheckSpacing <- R6Class(
  classname = "step_check_spacing",
  inherit = Step,
  public = list(
    # step specific variables
    initialize = function(terms,
                          role = "check",
                          ...) {

      # get function parameters to pass to parent
      terms <- substitute(terms)
      env_list <- get_function_arguments()
      # print(env_list)
      env_list$step_name <- "step_check_spacing"
      env_list$type <- "check"
      super$initialize(
        terms = terms,
        env_list[names(env_list) != "terms"],
        ...
      )

      invisible(self)
    },
    bake = function(s) {

      self$check <- collapse::fndistinct(collapse::fdiff(s[["result"]])) == 1L

      return(NULL)
    }
  )
)
jkennel/hydrorecipes documentation built on April 17, 2025, 4 p.m.