cut.quantile <- function(x, N, use.ppoints=TRUE) {
  qq <- if (use.ppoints) c(0,ppoints(N-1),1)
  else seq(0, 1, 1/N)
  breaks <- quantile(x, qq)
  breaks[1] <- breaks[1] - 1 
  breaks[N+1] <- breaks[N+1]+1
  cut(x, breaks)
}
tmpT <- cut.quantile(rnorm(100), 10, TRUE)
table(tmpT)
tmpF <- cut.quantile(rnorm(100), 10, FALSE)
table(tmpF)