From ripley at stats.ox.ac.uk  Mon Oct  3 18:17:48 2016
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 3 Oct 2016 17:17:48 +0100
Subject: [Rd] grep
In-Reply-To: <CAEQWovS-Ymxz6RJ92_7eRBkxqdJ3CxQdL1DNJEpjQkRpTmcXsA@mail.gmail.com>
References: <CAEQWovS-Ymxz6RJ92_7eRBkxqdJ3CxQdL1DNJEpjQkRpTmcXsA@mail.gmail.com>
Message-ID: <00e4fcd9-b720-de32-0978-5ed2b8f142dd@stats.ox.ac.uk>

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



[Rd] grep
Prof Brian Ripley