R/new_bagofpatterns.R

Defines functions new_bagofpatterns

new_bagofpatterns <- function(data, target, ...) {
  # Validate input
  if (!is.data.frame(data)) {
    stop("'data' must be a data frame", call. = FALSE)
  }
  
  if (!(target %in% colnames(data))) {
    stop("Target column '", target, "' not found in data", call. = FALSE)
  }
  
  # Create and return object
  structure(
    list(
      training_data = data,
      converted_training_data = NULL,  # Initialize as NULL instead of NA
      target = target,
      SAX_args = list(...),
      model_args = NULL  # Initialize as NULL instead of NA
    ),
    class = "bagofpatterns"
  )
}
mattsq/bagofpatternsr documentation built on April 5, 2025, 3:05 a.m.