I have a column with strings:
name aldrinas63_rios200_2001 sa_c.fr.1234
I want to count the number of digits in each cell: I have used the
Try this:
nchar(gsub("\\D", "", data$name))
Example
s <- c("aldrinas63_rios200_2001","sa_c.fr.1234") nchar(gsub("\\D", "", s)) #[1] 9 4