9

Simply put, I have the following data frame:

        Signal
    4   9998
    3   549
    1   18
    5   2.342
    2   0.043

and I want to reset the index numbers to be like :

        Signal
    1   9998
    2   549
    3   18
    4   2.342
    5   0.043
josliber
  • 43,891
  • 12
  • 98
  • 133
mtleis
  • 712
  • 1
  • 9
  • 28
  • 2
    Try `yourdf <- yourdf[order(-yourdf$Signal),, drop=FALSE];row.names(yourdf) <- NULL` – akrun Jun 03 '15 at 16:52
  • @akrun, Thank you for your comment. To reset the index number, part of your code : 'row.names(yourdf) <- NULL' was the answer, would you like to post it as an answer? – mtleis Jun 04 '15 at 09:35

1 Answers1

24

You can use

 row.names(yourdf) <- NULL

to reset the row names

akrun
  • 874,273
  • 37
  • 540
  • 662