R/as.number.R

Defines functions as.number

as.number <- function(x) {
  warn <- getOption("warn"); options(warn = -1)

  y <- try(as.numeric(x))

  options(warn = warn)

  if (any(is.na(y))) {
    as.character(x)
  }
  else {
    as.character(format(y))
  }
} ## as.number

Try the rebmix package in your browser

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

rebmix documentation built on Feb. 9, 2024, 3:01 p.m.