Skip to content

re arrange according to first positions

3 messages · Ragia Ibrahim, Rui Barradas, MacQueen, Don

#
Dear all,
I have a data frame, where multible process and ordering done  ..can I re arrange (re order ) it regarding  it' s original ROW index ? how?
example
   Xi      items         numrber_list_items
3    8  8, 7, 3, 4                4
2    7     7, 3, 4                0
1   10          10                1
result should be starting from row index 1 to 3.

thanks in advance
Ragia
#
Hello,

If your data.frame is named 'dat', try something like the following.

dat[order(rownames(dat)), ]


Hope this helps,

Rui Barradas

Em 28-08-2014 08:56, Ragia Ibrahim escreveu:
#
For future reference, perhaps creating an index variable when the data
frame is first created and before ?multiple process and ordering? is done
would be good.

  mydat$index <- seq(nrow(mydat))