Re: [R] Pattern match

2013-03-20 Thread Christofer Bogaso
Thanks Mark for your reply. Actually I was looking for following type of solution: > grep("(wti)|(asdf)", c("aa", "wti-fgg", "wtihjg", "fdsdasdf", "wti")) [1] 2 3 4 5 However I was able to find the solution just using grep() function. On Wed, Mar 20, 2013 at 11:48 PM, Mark Sharp wrote: > I lik

Re: [R] Pattern match

2013-03-20 Thread Mark Sharp
I like the stringr package. Its functions allow vectors for the patterns. >From the examples of str_detect() > fruit <- c("apple", "banana", "pear", "pinapple") > str_detect(fruit, "a") [1] TRUE TRUE TRUE TRUE > str_detect(fruit, "^a") [1] TRUE FALSE FALSE FALSE > str_detect(fruit, "a$") [1] FAL

Re: [R] Pattern match

2013-03-20 Thread Milan Bouchet-Valat
Le mercredi 20 mars 2013 à 21:58 +0530, Christofer Bogaso a écrit : > Hello again, in the help page of grep() function, it is written that > > pattern: > > character string containing a regular expression (or character string > for fixed = TRUE) to be matched in the given character vector. Coerc

[R] Pattern match

2013-03-20 Thread Christofer Bogaso
Hello again, in the help page of grep() function, it is written that pattern: character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Coerced by as.character to a character string if possible. If a character vector of l

Re: [R] Pattern match

2011-04-22 Thread neetika nath
Thank you so much. On Fri, Apr 22, 2011 at 1:29 PM, David Winsemius wrote: > > On Apr 22, 2011, at 6:42 AM, neetika nath wrote: > > > Thank you for your message. please see attach file for the template/test > dataset of my file. > > > On Thu, Apr 21, 2011 at 1:30 PM, David Winsemius > wrote: > >

Re: [R] Pattern match

2011-04-22 Thread David Winsemius
On Apr 22, 2011, at 6:42 AM, neetika nath wrote: > > Thank you for your message. please see attach file for the template/ > test dataset of my file. > > > On Thu, Apr 21, 2011 at 1:30 PM, David Winsemius > wrote: > > On Apr 21, 2011, at 5:27 AM, neetika nath wrote: > > Thank you Dennis, > > yes

Re: [R] Pattern match

2011-04-22 Thread neetika nath
Thank you for your message. please see attach file for the template/test dataset of my file. On Thu, Apr 21, 2011 at 1:30 PM, David Winsemius wrote: > > On Apr 21, 2011, at 5:27 AM, neetika nath wrote: > > Thank you Dennis, >> >> yes the problem is the input file. i have .rdf file and the forma

Re: [R] Pattern match

2011-04-21 Thread David Winsemius
On Apr 21, 2011, at 5:27 AM, neetika nath wrote: Thank you Dennis, yes the problem is the input file. i have .rdf file and the format is in same way i have posted earlier. if i open that file in notepad++ the lines are divided or broken with CR+LF character. so any suggestion to retriev

Re: [R] Pattern match

2011-04-21 Thread neetika nath
Thank you Dennis, yes the problem is the input file. i have .rdf file and the format is in same way i have posted earlier. if i open that file in notepad++ the lines are divided or broken with CR+LF character. so any suggestion to retrieve SpeciesScientific information without changing the input

Re: [R] Pattern match

2011-04-20 Thread Dennis Murphy
Hi: This is a bit of a roundabout approach; I'm sure that folks with regex expertise will trump this in a heartbeat. I modified the last piece of the string a bit to accommodate the approach below. Depending on where the strings have line breaks, you may have some odd '\n' characters inserted. #

[R] Pattern match

2011-04-20 Thread Neeti
Hi ALL, I have very simple question regarding pattern matching. Could anyone tell me how to I can use R to retrieve string pattern from text file. for example my file contain following information SpeciesCommon=(Human);SpeciesScientific=(Homo sapiens);ReactiveCentres=(N,C,C,C,+ H,O,C,C,C,C,O,H);

Re: [R] Pattern match in R

2008-09-30 Thread Gabor Grothendieck
Try this where ? signifies that the prior character is optional: dir(pattern = "^Coverage_[1-9]?[0-9]$") On Tue, Sep 30, 2008 at 10:36 AM, bioinformatics_guy <[EMAIL PROTECTED]> wrote: > > I want to make sure this piece of code I wrote is doing what I want it to do. > > ll<-function(string) > {

Re: [R] Pattern match in R

2008-09-30 Thread Ted Harding
On 30-Sep-08 14:36:04, bioinformatics_guy wrote: > I want to make sure this piece of code I wrote is doing what > I want it to do. > > ll<-function(string) > { > grep(string,dir(),value=T) > } > > subdir = ll("Coverage_[1-9][0-9]$") > > I basically wrote a little function that would grab a

Re: [R] Pattern match in R

2008-09-30 Thread Richard . Cotton
> I want to make sure this piece of code I wrote is doing what I want it to do. > > ll<-function(string) > { >grep(string,dir(),value=T) > } > > > subdir = ll("Coverage_[1-9][0-9]$") > > I basically wrote a little function that would grab all the files of form > Coverage_[0-99] > > The w

[R] Pattern match in R

2008-09-30 Thread bioinformatics_guy
I want to make sure this piece of code I wrote is doing what I want it to do. ll<-function(string) { grep(string,dir(),value=T) } subdir = ll("Coverage_[1-9][0-9]$") I basically wrote a little function that would grab all the files of form Coverage_[0-99] The way I wrote it, will it g