R/getCol.R

getCol <- function (x,warn=FALSE) {
if(!inherits(x,"tile.list"))
    stop("Argument \"x\" must be of class \"tile.list\".\n")
ccc <- unlist(sapply(x,function(u){u[["z"]]}))
if(is.null(ccc)) return(NA)
ccc <- try(apply(col2rgb(ccc, TRUE), 2,
             function(x){do.call(rgb, as.list(x/255))}),silent=TRUE)
if(inherits(ccc,"try-error")){
    if(warn) warning(paste("Cannot interpret the z-components of",
                        "argument \"x\" as colours.\n"))
    return(NA)
}
ccc
}

Try the deldir package in your browser

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

deldir documentation built on May 29, 2024, 7:58 a.m.