Re: [R] Help with indexing

2009-11-21 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dana Sevak > Sent: Saturday, November 21, 2009 4:00 PM > To: r-help@r-project.org > Subject: [R]

Re: [R] Help with indexing

2009-11-21 Thread jim holtman
try this: > # create a factor and then convert back to numeric > x$nb <- as.integer(factor(x$name, levels=unique(x$name))) + 99 > x name freq nb 1 Mary1 100 2 Mary2 100 3 Mary3 100 4 Sam1 101 5 Sam2 101 6 John1 102 7 John2 102 8 John3 102 9 John4 102 On S

[R] Help with indexing

2009-11-21 Thread Dana Sevak
Dear R Helpers, I am missing something very elementary here, and I don't seem to get it from the help pages of the ave, seq and seq_along functions, so I wonder if you could offer a quick help. To use an example from an earlier post on this list, I have a dataframe of this kind: dat = data.fr