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 following code:
str_count(data$name, '\d+')
But I have getting the output as:
Name output_I_get
aldrinas63_rios200_2001 3
sa_c.fr.1234 1
But my desired output is as follows:
name output
aldrinas63_rios200_2001 9
sa_c.fr.1234 4
Any help in this regard will be highly appreciated!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…