Skip to content
Prev 301800 / 398503 Next

How can I parse this string to extract just the number 11?

Hello,

Try the following.

string <- "\t\t\t\t\t<span class=\"compliment-count profile\">11</span>"
gsub("[^[:digit:]]", "", string)

Then use as.numeric or as.integer.

Hope this helps,

Rui Barradas

Em 31-07-2012 01:19, Shelby McIntyre escreveu: