R/extract_number.R

Defines functions extract_number

extract_number <- function(x)
{
  n <- nchar(x)
  ext_num <- substring(x, 1:n, 1:n)
  numbers <- 0:9
  num <- NULL
  for (i in ext_num){
    if (i %in% numbers){
      num <- paste(num,i,sep="")
    }
  }
  num <- as.numeric(num)
  return(num)
}
PabloMBooster/vmsR documentation built on June 29, 2023, 11:16 a.m.