R/credo.cut.r

#' Quick Cut
#' 
#' Produces a quick cut of a variable by various tiles
#' 
#' @param x A numeric vector (or integer)
#' @param breaks The number of breaks to create using \link{quantile} or predefined breaks
#' @param ... other arguments passed to \link{cut}
#' @export

credo.cut <- function(x,breaks=5,right=TRUE,include.lowest=TRUE,...) { 
  if(length(breaks) == 1) {
    x <- cut(x, c(-Inf, quantile(x,seq(0,1,1/breaks))),...)
  }
  if(length(breaks) > 1) {
    x <- cut(x, c(-Inf, breaks,Inf),...)    
  }
  return(x)
}
credoinc/credoc documentation built on May 23, 2019, 8:39 a.m.