R/abbrNum.R

Defines functions abbrNum

abbrNum <- function(xx) {
  x <- unique(xx)
  l <- format.info(x)
  if (length(l) == 1) {
    lab <- x
  } else if (l[2] > 0) {
    digits <- max(ceiling(-log10(sd(x))) + 1, 0)
    lab <- formatC(x, digits=digits, format="f")
  } else {
    lab <- x
  }
  lab
}

Try the visreg package in your browser

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

visreg documentation built on July 1, 2020, 10:24 p.m.