R/step_indicate_na.R

Defines functions orbital.step_indicate_na

#' @export
orbital.step_indicate_na <- function(x, all_vars, ...) {
	cols <- x$columns
	col_names <- glue::glue("{x$prefix}_{cols}")

	used_vars <- col_names %in% all_vars
	cols <- cols[used_vars]
	col_names <- col_names[used_vars]

	if (length(col_names) == 0) {
		return(NULL)
	}

	out <- glue::glue("as.integer(is.na({cols}))")

	names(out) <- col_names
	out
}

Try the orbital package in your browser

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

orbital documentation built on April 3, 2025, 8:47 p.m.