Skip to content
Prev 22843 / 63424 Next

invert argument in grep

On Fri, 10 Nov 2006, Duncan Murdoch wrote:

            
Note that grep("pat", x, value = TRUE) is not the same as x[grep("pat", x)],
as the help page carefully points out.  (I think it would be better 
if it were.)
(BTW, sending whole files makes it difficult to see the changes and even 
harder to merge them; please use diffs.  From a quick look the changes 
were very incomplete, as the internal functions were changed and there 
were no changed C files.)
I don't think that is pertinent here, as the indices are always a vector 
of positive integers.
That might be worthwhile, but it is relatively simple to change positive 
integer indices to logical ones and v.v.

My personal take is that having 'value=TRUE' was already a complication 
not worth having, and implementing it at C level was an efficiency tweak 
not worth the maintenance effort (and also means that '[' methods are not 
dispatched).