[R] character position
jholtman at gmail.com
Thu Sep 18 10:57:51 CEST 2008
If it always occurs after 'are', this will work:
> x <- 'There are 20 species in this grid'
> y <- sub(".*are (\\d+).*", "\\1", x, perl=TRUE)
On Thu, Sep 18, 2008 at 4:51 AM, Paulo Cardoso <pecardoso at netcabo.pt> wrote:
> I'm not being able to capture a position of a 'string' in a character
> In this example: 'There are 20 species in this grid'
> I would like to capture the string (number) after 'are' and before
> 'species'. Consider they do not change. I wouldn't like to use substr
> because stop position may change.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help