How to do a shift/rotate os a list?
if
a = c(1,2,3)
what is the best way to make a equal
c(3,1,2)
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
On Thu, 9 Mar 2006, Omar Lakkis wrote:
How to do a shift/rotate os a list?
if
a = c(1,2,3)
what is the best way to make a equal
c(3,1,2)
a - c(a[length(a)],a[-length(a)])
or
n - length(a)
a - c(a[n],a[-n])
David Scott
_
a = c(1,2,3)
a
[1] 1 2 3
rev(a)
[1] 3 2 1
PS: a in your example is not a list; i.e class(a)
From: Omar Lakkis [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] shift / rota
Date: Thu, 9 Mar 2006 15:51:51 -0500
How to do a shift/rotate os a list?
if
a = c(1,2,3)
what is the best way