R/1.1.checkWeightsRequirements.R

Defines functions checkWeightsRequirements

checkWeightsRequirements <- function(weights) {
  if (dim(weights)[2] > 1) {
    stop("Invalid 'weights' argument. Must be one-dimensional!")
  } else if (typeof(weights$value) == "character" | typeof(weights$value) == "logical") {
    stop("Invalid 'weights' argument. Shouldn't be character or logical!")
  } else if (any(is.na(weights$value))) {
    stop("Invalid 'weights' argument. Shouldn't have NA values!")
  } else if (any(weights$value <= 0)) {
    stop("Invalid 'weights' argument. Must be greater than zero!")
  }

  return(NULL)
}

Try the Mmcsd package in your browser

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

Mmcsd documentation built on March 31, 2023, 7:23 p.m.