I want to test a vector of character strings and determine if each one contains elements that are numeric or symbols (ie I want to know if a string is more than just alpha characters and spaces). I’ve solved it here but am wondering if there’s a more efficient way (in R regex).
x <- c("ff d fdf4f", "fve dvgf", "vfev!", "rcvce rc&")
nchar(gsub("[a-zA-Z]|\\s+", "", x)) > 0
greplalong with looking for characters that don’t meet what you want seems to workThis gives the same output as your original code