Re: [R] Derive pattern from vector

2012-02-11 Thread syrvn
fantastic. Thanks for that chunk of code. Works great! :) -- View this message in context: http://r.789695.n4.nabble.com/Derive-pattern-from-vector-tp4379312p4379402.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Derive pattern from vector

2012-02-11 Thread Petr Savicky
On Sat, Feb 11, 2012 at 09:11:12AM -0800, syrvn wrote: > Hello, > > consider the following vector 'chars': > > > chars <- c(A, B, C, C, D, E, E, E, F, F, F) > > > I need to convert 'chars' into the following pattern: > > > 1, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8 > > As soon as there are duplicates

[R] Derive pattern from vector

2012-02-11 Thread syrvn
Hello, consider the following vector 'chars': chars <- c(A, B, C, C, D, E, E, E, F, F, F) I need to convert 'chars' into the following pattern: 1, 2, 3, 3, 4, 5, 5, 5, 6, 7, 8 As soon as there are duplicates they get the same number otherwise it's increasing numbers. However, for the char