R/helper-integer-switch.R

Defines functions integer_switch

integer_switch <- function(field_name, codes) {
    if (is.null(codes)) return(NULL)
    ints <- as.integer(codes)
    if (any(codes != ints)) stop(field_name, " must be an integer")

    .call <- list(
        quote(`%in%`),
        as.name(field_name),
        ints
    )
    as.call(.call)
}
cwolfsonseeley/discoveryengine documentation built on Sept. 30, 2023, 2:07 p.m.