R/detect_numeric.R

Defines functions detect_numeric

Documented in detect_numeric

#' @title Identifies numerics
#' 
#' @description A function to recognize if the content of a column seems to be numeric.
#' 
#' @author Briac LE RAY (briac.leray@partnre.com)
#' 
#' @return TRUE if the column seems to contain dates, otherwise FALSE.
#' @param df_column The column to control. Type = dataframe
#' @keywords detect numeric detect_numeric() control
#' @examples detect_numeric(df_column = my_column)

detect_numeric <- function(df_column) {
  if(all(str_detect(df_column, "[a-z]", negate = TRUE), na.rm = TRUE) & all(str_detect(df_column, "\\W", negate = TRUE), na.rm = TRUE)) { return(TRUE)} #search for a non numeric character
  
  return(FALSE)
}
Tiipiac/StressTestOptimization documentation built on Dec. 18, 2021, 5:08 p.m.