R/firstnumpos.R

Defines functions firstnumpos

Documented in firstnumpos

#' firstnumpos
#'
#' Identify word position of first number in string
#' @param str1 string 1
#' @export
firstnumpos <- function(str1){
  min(which(!is.na(suppressWarnings(as.numeric(str_split(trimws(gsub("  "," ",str1)), " ", simplify = TRUE))))))
}
nbarsch/tfwstring documentation built on May 4, 2023, 5:26 a.m.