> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Waverley @
> Palo Alto
> Sent: Sunday, August 22, 2010 3:51 PM
> To: r-help
> Subject: Re: [R] how to implement string pattern extraction in R
>
&
Thanks for the reply to pointing me to the grep functions.
I have checked the readme page
http://pbil.univ-lyon1.fr/library/base/html/grep.html before I sent
the help request.
Just don't know how to extract a substring matching a pattern out of a
string. Can someone give me the example code simi
On Sun, Aug 22, 2010 at 6:05 PM, Waverley @ Palo Alto
wrote:
> Hi,
>
> In perl, to get a substring matching a particular pattern can be
> implemented like the following example:
>
> $x = ".txt";
> if ($x=~ /(.*?)\.txt/){
> $prefix = $1;
> }
>
> So how to do the same thing in R?
>
> Can someo
Hi Waverley,
I am not familiar at all with perl, but this should get you headed in
the right direction:
#Some documentation that might help
?regexpr
?grep
?regexp
#I imagine you sould do something like
x <- ".txt"
regexpr(pattern = "yourpattern", text = x)
grep(pattern = "yourpattern", x =
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Waverley @ Palo Alto
> Sent: Sunday, August 22, 2010 3:05 PM
> To: r-help
> Subject: [R] how to implement string pattern extraction in R
>
> Hi,
>
&g
Hi,
In perl, to get a substring matching a particular pattern can be
implemented like the following example:
$x = ".txt";
if ($x=~ /(.*?)\.txt/){
$prefix = $1;
}
So how to do the same thing in R?
Can someone provide me the code sample?
Thanks much in advance.
--
Waverley @ Palo Alto
6 matches
Mail list logo