R/na.pattern.s

Defines functions na.pattern

Documented in na.pattern

na.pattern <- function(x)
{
  k <- ncol(x)
  pattern <- ''
  idt <- is.data.table(x)
  for(i in 1 : k) {
    y <- if(idt) x[, ..i] else x[, i]
    pattern <- paste0(pattern, 1 * is.na(y))
    }
  table(pattern)
}
utils::globalVariables('..i')

Try the Hmisc package in your browser

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

Hmisc documentation built on Sept. 12, 2023, 5:06 p.m.