R/check_possible_numeric.R

Defines functions check_possible_numeric

Documented in check_possible_numeric

#' check_possible_numeric
#' @param data data
#' @importFrom dplyr pull 
#' @importFrom purrr map_lgl
#' @export
#' @return vector index
check_possible_numeric <- function(data) {
  check_numeric_sample <- function(x) {
    temp<-data[,x] |> pull()
    temp<-ifelse(is.na(temp), 0, temp)
    #temp<-temp[!is.na(temp)]
    temp<-sample(temp, 20)
    
    x <- any(!is.na(as.numeric(temp )))
    x
  }
  return(which(map_lgl(1:ncol(data), check_numeric_sample)))
}
JohanSalomonssonSV/jsalomon documentation built on Jan. 30, 2024, 4:40 a.m.