See http://r.789695.n4.nabble.com/reorder-a-matrix-td4588839.html#a4588845
--JIV


On Thu, Apr 26, 2012 at 10:31 PM, Rebecca <> wrote:

> Hi,
> Here are part of my data,
>
> > pr16.5
>    origin dest ldco time.slot distortion
> 1       1    1    1         1        4.3
> 2       1    1    1         2        4.7
> 3       1    1    1         3        5.6
> 4       1    1    1         4        7.7
> 5       1    1    2         1        6.8
> 6       1    1    2         2        7.6
> 7       1    1    2         3        9.2
> 8       1    1    2         4       10.7
> 9       1    1    3         1        2.3
> 10      1    1    3         2        2.2
> 11      1    1    3         3        2.6
> 12      1    1    3         4        4.3
> 13      1    2    1         1        3.2
> 14      1    2    1         2        5.4
> 15      1    2    1         3        4.9
> 16      1    2    1         4       10.7
> 17      1    2    2         1        5.6
> 18      1    2    2         2        8.0
> 19      1    2    2         3        7.7
> 20      1    2    2         4       13.1
> 21      1    2    3         1        0.3
> 22      1    2    3         2        2.3
> 23      1    2    3         3        3.0
> 24      1    2    3         4        8.2
>
> I want to reorder the matrix according to variable time.slot, i.e.
> time slot<- c(1,1,1,1,1,...,2,2,2,2....,3,3,3,3....,4,4,4,4,...)
> Is there any way like a command or construct a function?
> Thanks!
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

	[[alternative HTML version deleted]]

