Re: [R] Extract Element of String with R's Regex

2008-08-01 Thread Gabor Grothendieck
On Fri, Aug 1, 2008 at 7:31 AM, Stephen Tucker <[EMAIL PROTECTED]> wrote: > In the example below, a straight application of strsplit() is probably the > simplest solution. In a more general case where it may be desirable to match > patterns, a combination of sub() or gsub() with strsplit() might

Re: [R] Extract Element of String with R's Regex

2008-08-01 Thread Stephen Tucker
Blomberg <[EMAIL PROTECTED]> To: Edward Wijaya <[EMAIL PROTECTED]> Cc: r-help@r-project.org Sent: Thursday, July 31, 2008 11:48:23 PM Subject: Re: [R] Extract Element of String with R's Regex How about: unlist(strsplit(x, split=" "))[c(4:5,10)] That perl script looks

Re: [R] Extract Element of String with R's Regex

2008-07-31 Thread Simon Blomberg
How about: unlist(strsplit(x, split=" "))[c(4:5,10)] That perl script looks like a good reason to avoid perl. Simon. On Fri, 2008-08-01 at 15:13 +0900, Edward Wijaya wrote: > Hi, > > I have this string, in which I want to extract some of it's element: > > > x <- "Best-K Gene 11340 211952_at R