R/dep-extract.R

Defines functions extract_numeric

Documented in extract_numeric

# nocov start

#' Extract numeric component of variable.
#'
#' DEPRECATED: please use `readr::parse_number()` instead.
#'
#' @param x A character vector (or a factor).
#' @keywords internal
#' @export
extract_numeric <- function(x) {
  message(
    "extract_numeric() is deprecated: please use readr::parse_number() instead"
  )
  as.numeric(gsub("[^0-9.-]+", "", as.character(x)))
}

# nocov end
tidyverse/tidyr documentation built on April 13, 2025, 11:51 a.m.