Message-ID: <501789D9.4080305@sapo.pt>
Date: 2012-07-31T07:31:37Z
From: Rui Barradas
Subject: How can I parse this string to extract just the number 11?
In-Reply-To: <C5E26340-8886-48BE-A87C-CA8316F8597B@scu.edu>
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:
> Below is the string to parse and return the embedded number = "11"
>
> string = "\t\t\t\t\t<span class=\"compliment-count profile\">11</span>"
>
>
>
>
>
>
> On Jul 29, 2012, at 3:00 AM, r-help-request at r-project.org wrote:
>
>> char
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.