R/get_first.r

Defines functions get_first

Documented in get_first

#' Get first digit
#'
#' Returns the first digit of a larger number.
#'
#' @param x a large number (of class numeric or integer)
#'
#' @return The first digit.
#' @export
get_first <- function(x) {
  as.numeric(substr(as.character(x), 1, 1))
}
andrewpbray/reed-oilabs documentation built on April 8, 2020, 2:26 a.m.