I have string like this:
years<-c(\"20 years old\", \"1 years old\")
I would like to grep only the numeric number from this vector. Expe
A stringr pipelined solution:
stringr
library(stringr) years %>% str_match_all("[0-9]+") %>% unlist %>% as.numeric