[Rd] grep

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 3 18:17:48 CEST 2016


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 grep does not have this (nor any other 
commonly used implementation I am aware of) indicates that your 
enthusiasm for this is not shared by grep experts.

> That would allow to stop a grep search as soon as something is found.
> It would make many operations much faster.

Those who would have to do the work to implement this will not be taking 
your word for that, but would expect convincing examples of real 
problems where it was so and grep was the bottleneck.

Your 'case' seems to be for a shortcut for any(grepl()) along the lines 
of anyDuplicated().

> 	[[alternative HTML version deleted]]

This is a non-HTML list, as the posting guide told you.  And using a 
real name adds credibility.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-devel mailing list