Skip to content
Prev 274305 / 398506 Next

Create order of numbers based on a given vector

I don't have access to R so I can't test my example but I think this will work.

vec ( as defined by you)

# flip the false and the trues
vec1<-ifelse(vec==FALSE,TRUE,FALSE)

ans<-cumsum(vec)

Regards,
Ashim
On Thu, Oct 13, 2011 at 4:45 PM, syrvn <mentor_ at gmx.net> wrote: