R/Tools.R

Defines functions check.idOrLogical check.basis

### Various Helper Functions


### Check Basis
check.basis = function(x) {
	if( ! x %in% c("xyz","abc"))
		stop("'basis' must be equal to 'xyz' or 'abc'");
}

# id or Logical
check.idOrLogical = function(x, max, lbl) {
	if(any(round(x) != x))
		stop(paste0(lbl, " must be a logical or integer vector"));
    if(any(x > max))
      stop(paste0(lbl, " contains indices out of range"));
}

Try the Rpdb package in your browser

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

Rpdb documentation built on March 16, 2026, 5:07 p.m.