Re: [R] Create factor variable by groups

2011-07-05 Thread Dennis Murphy
Hi: There are several ways to do this; I'll offer one from the plyr package. See inline. On Mon, Jul 4, 2011 at 9:57 PM, Mateus Rabello wrote: > Hi, suppose that I have the following data.frame: > >      cnae4 cnpj 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 Y >      24996 10020470 1 1 2 1

[R] Create factor variable by groups

2011-07-04 Thread Mateus Rabello
Hi, suppose that I have the following data.frame: cnae4 cnpj 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 Y 24996 10020470 1 1 2 12 16 21 17 51 43 19 183 24996 10020470 69 91 79 92 91 77 90 96 98 108 891 36145 10020470 0 0 0 0 2 83 112 97 91 144 529 4 100