Re: [Rd] grep

2016-10-03 Thread Prof Brian Ripley
On 02/10/2016 17:54, Pi wrote: Hello. It would be great if the grep function in R had the option to use the -m parameter as the linux command does. I guess you mean the non-standard flag of the GNU version of grep (probably but not necessarily as used by Linux). That the POSIX standard for

[Rd] grep

2016-10-02 Thread Pi
Hello. It would be great if the grep function in R had the option to use the -m parameter as the linux command does. That would allow to stop a grep search as soon as something is found. It would make many operations much faster. [[alternative HTML version deleted]] _

Re: [Rd] grep and PCRE fun

2011-09-30 Thread Prof Brian Ripley
On Fri, 30 Sep 2011, Simon Urbanek wrote: Jeff, this is really a bug in PCRE since the length (0) is a multiple of 3 as documented so PCRE should not be writing anything. Anyway, this has been now fixed (by Brian). Only in R-devel: R-2-13-branch is now closed (and was by the time I read th

Re: [Rd] grep and PCRE fun

2011-09-30 Thread Simon Urbanek
Jeff, this is really a bug in PCRE since the length (0) is a multiple of 3 as documented so PCRE should not be writing anything. Anyway, this has been now fixed (by Brian). Cheers, Simon On Sep 29, 2011, at 5:00 PM, Jeffrey Horner wrote: > Hello, > > I think I've found a bug in the C functi

Re: [Rd] grep and PCRE fun

2011-09-29 Thread Henrik Bengtsson
On Thu, Sep 29, 2011 at 2:00 PM, Jeffrey Horner wrote: > Hello, > > I think I've found a bug in the C function do_grep located in > src/main/grep.c. It seems to affect both the latest revisions of > R-2-13-branch and trunk when compiling R without optimizations and > with it's own version of pcre

Re: [Rd] grep and PCRE fun

2011-09-29 Thread Jeffrey Horner
On Thu, Sep 29, 2011 at 4:00 PM, Jeffrey Horner wrote: > Hello, > > I think I've found a bug in the C function do_grep located in > src/main/grep.c. It seems to affect both the latest revisions of > R-2-13-branch and trunk when compiling R without optimizations and > with it's own version of pcre

[Rd] grep and PCRE fun

2011-09-29 Thread Jeffrey Horner
Hello, I think I've found a bug in the C function do_grep located in src/main/grep.c. It seems to affect both the latest revisions of R-2-13-branch and trunk when compiling R without optimizations and with it's own version of pcre located in src/extra, at least on ubuntu 10.04. According to the

Re: [Rd] grep problem in R-devel 2.14 r57004

2011-09-16 Thread Simon Urbanek
I forgot to mention the more obvious ;) - yes, it is a known issue in PCRE 8.13 which is hitting more people. After re-reading the standard I think the problem was that PCRE did not require enclosing [ to treat [. as special. This has been addressed in the PCRE trunk since and it also has a com

Re: [Rd] grep problem in R-devel 2.14 r57004

2011-09-16 Thread Simon Urbanek
Mark, quick googling gives the answer - [.] is not what you think it is, you probably meant [\.]. Bracket expressions starting with [. are collating symbols which is unsupported by PCRE (only [:xxx:] is supported, neither [=xxx=] nor [.xxx.] is) but that's probably not what you intended. See POS

[Rd] grep problem in R-devel 2.14 r57004

2011-09-15 Thread Mark.Bravington
Problem below with PCRE grep in R-devel; works fine in R-patched. (Unless there's been an absolutely massive change in rules for updated PCRE version 8.13; jeez I hope not) > grep( '[.][.]', '', perl=TRUE) Error in grep("[.][.]", "", perl = TRUE) : invalid regular expression '[.][.]' In additi

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-17 Thread Prof Brian Ripley
On Thu, 17 May 2007, Petr Savicky wrote: >> strncasecmp is not standard C (not even C99), but R does have a substitute >> for it. Unfortunately strncasecmp is not usable with multibyte charsets: >> Linux systems have wcsncasecmp but that is not portable. In these days of >> widespread use of UTF

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-17 Thread Petr Savicky
> strncasecmp is not standard C (not even C99), but R does have a substitute > for it. Unfortunately strncasecmp is not usable with multibyte charsets: > Linux systems have wcsncasecmp but that is not portable. In these days of > widespread use of UTF-8 that is a blocking issue, I am afraid.

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-14 Thread Prof Brian Ripley
On Fri, 11 May 2007, Petr Savicky wrote: > On Wed, May 09, 2007 at 06:41:23AM +0100, Prof Brian Ripley wrote: >> I suggest you collaborate with the person who replied that he thought this >> was a good idea to supply patches against the R-devel sources for >> scrutiny. > > A possible solution is t

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-11 Thread Petr Savicky
On Wed, May 09, 2007 at 06:41:23AM +0100, Prof Brian Ripley wrote: > I suggest you collaborate with the person who replied that he thought this > was a good idea to supply patches against the R-devel sources for > scrutiny. A possible solution is to use strncasecmp instead of strncmp in function

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-08 Thread Prof Brian Ripley
On Mon, 7 May 2007, Petr Savicky wrote: > Dear R developers, > > I suggest to modify the behaviour of "grep" function with fixed=TRUE option. > > Currently, fixed=TRUE implies ignore.case=FALSE (overrides ignore.case=TRUE, > if set by the user). As it clearly says it does. > I suggest to keep ig

Re: [Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-07 Thread Gabor Grothendieck
Seems like a good idea to me. Here is a workaround that works in any event which combines (?i), \Q and \E . to get the same effect. (?i) gives case insensitive matches and \Q and \E quote and endquote the intervening text disabling special characters: x <- c("D.G cat", "d.g cat", "dog cat") z <-

[Rd] grep with fixed=TRUE and ignore.case=TRUE

2007-05-07 Thread Petr Savicky
Dear R developers, I suggest to modify the behaviour of "grep" function with fixed=TRUE option. Currently, fixed=TRUE implies ignore.case=FALSE (overrides ignore.case=TRUE, if set by the user). I suggest to keep ignore.case as set by the user even if fixed=TRUE. Since the default of ignore.case

Re: [Rd] grep() and factors

2006-06-06 Thread Marc Schwartz (via MN)
On Tue, 2006-06-06 at 17:08 +0100, Prof Brian Ripley wrote: > On Tue, 6 Jun 2006, Marc Schwartz (via MN) wrote: > > > On Tue, 2006-06-06 at 11:12 +0100, Prof Brian Ripley wrote: > >> On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > >> > >>> Hi all, > >>> > >>> Based upon an offlist communicatio

Re: [Rd] grep() and factors

2006-06-06 Thread Prof Brian Ripley
On Tue, 6 Jun 2006, Marc Schwartz (via MN) wrote: > On Tue, 2006-06-06 at 11:12 +0100, Prof Brian Ripley wrote: >> On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: >> >>> Hi all, >>> >>> Based upon an offlist communication this morning, I am somewhat confused >>> (more than I usually am on most M

Re: [Rd] grep() and factors

2006-06-06 Thread Marc Schwartz (via MN)
On Tue, 2006-06-06 at 11:12 +0100, Prof Brian Ripley wrote: > On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > > > Hi all, > > > > Based upon an offlist communication this morning, I am somewhat confused > > (more than I usually am on most Monday mornings...) about the use of > > grep() with fa

Re: [Rd] grep() and factors

2006-06-06 Thread Prof Brian Ripley
On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > Hi all, > > Based upon an offlist communication this morning, I am somewhat confused > (more than I usually am on most Monday mornings...) about the use of > grep() with factors as the 'x' argument. > > The argument guidance in ?grep indicates: >

Re: [Rd] grep() and factors

2006-06-05 Thread Gabor Grothendieck
On 6/5/06, Bill Dunlap <[EMAIL PROTECTED]> wrote: > On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > > > > > > grep("[a-z]", factor(letters)) > > > > numeric(0) > > > > > > I was recently surprised by this also. In addition, if > > > R's grep did support factors in this way, what sort of > > >

Re: [Rd] grep() and factors

2006-06-05 Thread Bill Dunlap
On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > > > > grep("[a-z]", factor(letters)) > > > numeric(0) > > > > I was recently surprised by this also. In addition, if > > R's grep did support factors in this way, what sort of > > object (factor or character) should it return when value=T? > > I

Re: [Rd] grep() and factors

2006-06-05 Thread Sean Davis
Marc Schwartz (via MN) wrote: > On Mon, 2006-06-05 at 13:45 -0700, Bill Dunlap wrote: > >>On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: >> >> >>>Based upon an offlist communication this morning, I am somewhat confused >>>(more than I usually am on most Monday mornings...) about the use of >>>g

Re: [Rd] grep() and factors

2006-06-05 Thread Marc Schwartz (via MN)
On Mon, 2006-06-05 at 13:45 -0700, Bill Dunlap wrote: > On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > > > Based upon an offlist communication this morning, I am somewhat confused > > (more than I usually am on most Monday mornings...) about the use of > > grep() with factors as the 'x' argum

Re: [Rd] grep() and factors

2006-06-05 Thread Bill Dunlap
On Mon, 5 Jun 2006, Marc Schwartz (via MN) wrote: > Based upon an offlist communication this morning, I am somewhat confused > (more than I usually am on most Monday mornings...) about the use of > grep() with factors as the 'x' argument. > ... > > grep("[a-z]", letters) > [1] 1 2 3 4 5 6

[Rd] grep() and factors

2006-06-05 Thread Marc Schwartz (via MN)
Hi all, Based upon an offlist communication this morning, I am somewhat confused (more than I usually am on most Monday mornings...) about the use of grep() with factors as the 'x' argument. The argument guidance in ?grep indicates: x, text a character vector where matches are sought. Coerced to