R/ecdf.R

Defines functions .ecdf

# @export
.ecdf <- function(x,complement=FALSE) {
  if(is.table(x)) {
    tabz <- x
  } else {
    tabz <- table(x)
  }
  if(complement) {
    yval <- cumsum(rev(as.numeric(tabz)))/sum(tabz)
    yval <- rev(yval)
  } else {
    yval <- cumsum(as.numeric(tabz))/sum(tabz)
  }
  xval <- as.numeric(names(tabz))
  
  return(cbind("x"=rev(xval),"cdf(x)"=rev(yval)))
}

Try the meteR package in your browser

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

meteR documentation built on May 2, 2019, 11:04 a.m.