R/sameclass.R

Defines functions ischar sameclass

sameclass <- function(x, y) {
  if (is.numeric(x) && is.numeric(y)) {
    TRUE
  } else if (ischar(x) && ischar(y)) {
    TRUE
  } else {
    isTRUE(all.equal(class(x), class(y)))
  }
}

ischar <- function(x) {
  is.character(x) || is.factor(x)
}

Try the codelist package in your browser

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

codelist documentation built on April 12, 2025, 2:25 a.m.