R/scientific_10.R

Defines functions scientific_10

Documented in scientific_10

#' Scientific 10
#'
#' This is a helper function used to construct nice scales for plots (goes with scales package and ggplot2).
#'
#' @export

scientific_10 <- function(x) {
    xout <- gsub("1e", "10^{", format(x),fixed=TRUE)
    xout <- gsub("{-0", "{-", xout,fixed=TRUE)
    xout <- gsub("{+", "{", xout,fixed=TRUE)
    xout <- gsub("{0", "{", xout,fixed=TRUE)
    xout <- paste(xout,"}",sep="")
    return(parse(text=xout))
}
ctriandafillou/cat.extras documentation built on Aug. 27, 2020, 11:04 p.m.