R/tableplot_checkScales.R

Defines functions tableplot_checkScales

tableplot_checkScales <- function(scales, colNames, isNumber) {
	if (length(setdiff(scales, c("auto", "lin", "log")))>0) stop("<scales> should consist of auto, lin and log")

	if (is.null(names(scales))) {
		if (length(scales) != length(colNames)) {
			scales2 <- structure(rep(NA, length(colNames)), names=colNames)
			scales2[isNumber] <- rep(scales, length.out=sum(isNumber))
		} else scales2 <- structure(scales, names=colNames)
	} else {
		if (!all(names(scales) %in% colNames)) stop("<scales> is not correct")
		scales2 <- structure(rep(NA, length(colNames)), names=colNames)
		scales2[isNumber] <- "auto"
		scales2[names(scales)] <- scales
	}
	scales2	
}

Try the tabplot package in your browser

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

tabplot documentation built on Sept. 17, 2019, 5:04 p.m.