Ok I warned you that I'd been drinking! What I really meant was 
something to go from:

      [,1] [,2]
[1,]    1    2
[2,]    4    3

to

      [,1] [,2]
[1,]    4    1
[2,]    3    2

to

      [,1] [,2]
[1,]    3    4
[2,]    2    1

to

      [,1] [,2]
[1,]    2    3
[2,]    1    4

Sorry for being a muppet, B


Begin forwarded message:

> From: Benjamin Lloyd-Hughes <[EMAIL PROTECTED]>
> Date: 24 November 2005 16:15:58 GMT
> To: r-help@stat.math.ethz.ch
> Subject: Matrix rotation
>
> Dearest All,
>
> Ok so I've had a couple of glasses of wine over lunch today... This is 
> likely to be trivial but I'm struggling to find a more elegant way to 
> obtain the following matrix rotations:
>
> > M <- matrix(c(1,0,0,0), ncol=2)
> > M
>      [,1] [,2]
> [1,]    1    0
> [2,]    0    0
> > N <- abind(M[2,],M[1,],along=2)
> > N
>      [,1] [,2]
> [1,]    0    1
> [2,]    0    0
> > P <- abind(N[2,],N[1,],along=2)
> > P
>      [,1] [,2]
> [1,]    0    0
> [2,]    0    1
> > Q <- abind(P[,2],P[,1],along=2)
> > Q
>      [,1] [,2]
> [1,]    0    0
> [2,]    1    0
>
> And, more generally wish to rotate a n-dimensional data cube about 
> some specified axis.
>
> Cheers, Ben
>

        [[alternative text/enriched version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to