R/uniquePresent.R

Defines functions uniquePresent

uniquePresent <- function(x,req.n1=TRUE){
    un.x <- unique(x)
    un.x <- un.x[un.x!=""&!is.na(un.x)]
    if(length(un.x)==0) {
        warning("No value found")
        return(NA)
    }
    if(req.n1&&length(un.x)!=1) stop("Number of unique values is not 1.")
    un.x
}

Try the NMdata package in your browser

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

NMdata documentation built on Nov. 11, 2023, 5:07 p.m.