R/internal.R

Defines functions check_truelength overwrite_col

## overwite_col
## @param DT data.table
## @param col column name
## @keywords internal
overwrite_col <- function(DT = NULL, col = NULL) {
	if (col %in% colnames(DT)) {
		warning(paste0('overwriting ', col, ' column'))
		set(DT, j = eval(col), value = NULL)
	}
}

## check_truelength
## @param DT data.table
## @keywords internal
check_truelength <- function(DT) {
	if (truelength(DT) <= ncol(DT)) {
		stop('please run data.table::setalloccol on your DT to allocate columns')
	}
}
robitalec/irg documentation built on Sept. 19, 2023, 9:33 p.m.