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