PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/pkg/R/tableplot_checkBins.R

https://code.google.com/
R | 20 lines | 13 code | 0 blank | 7 comment | 4 complexity | 263de40d8a932cf36342c1608dda0d6a MD5 | raw file
 1#' Function to check the tableplot argument: number of bins.
 2#'
 3#' @aliases tableplot_checkBins
 4#' @param nBins the number of bins
 5#' @param nDat the number of data observations
 6#' @return the (possibly corrected) number of bins
 7#' @export
 8tableplot_checkBins <- function(nBins, nDat) {
 9	if (class(nBins)[1]!="numeric") stop("<nBins> is not numeric")
10	if (nBins > nDat) { 
11		if (nDat > 1000) {
12			warning("Setting nBins (",nBins,") to 1000")
13			nBins <- 1000
14		} else {
15			warning("Setting nBins (",nBins,") to number of rows (", nDat, ")")
16			nBins <- nDat
17		}
18	}
19	return(nBins)
20}