R/ROCsp.R

Defines functions .ROCsp

.ROCsp <- function(index, boolean, mask = NULL, nthres = NULL, thres = NULL, NAval = 0, progress = FALSE) {
  
  if(!is.null(nthres) & !is.null(thres)) stop("Enter nthres OR thres as input, not both at the same time")
  
  # extract cell values from the boolean and index maps 
  boolval <- values(boolean, mat = FALSE)
  indval <- values(index, mat = FALSE)
  
  # extract cell values from the mask map if given
  if(!is.null(mask)) mask <- values(mask, mat = FALSE)
  
  # calculate basic roc (toc) table
  tocd <- .ROCnosp(indval, boolval, mask = mask, nthres = nthres, thres = thres, NAval = NAval, progress = progress, 
                   ones.bool = NULL, zeros.bool = NULL)
  
  return(tocd) 
}

Try the TOC package in your browser

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

TOC documentation built on Feb. 16, 2023, 7:10 p.m.