This is rather simple-minded:
rot - function(x, k=1) {
k - k %% length(x)
x[c((k+1):length(x), 1:k)]
}
Andy
-Original Message-
From: Richard A. O'Keefe [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 1:28 AM
To: [EMAIL PROTECTED]
Subject: Re: [R] placing labels
Richard A. O'Keefe wrote:
I wrote:
I found myself wishing for a function to rotate a vector.
Is there one? I know about ?lag, but help.search(rotate)
didn't find anything to the point.
Here I was regarding a vector as a _sequence_.
The (one-step) rotation of c(u,v,w,x,y,z)
Dear Jens,
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 13 August 2003 10:01
To: [EMAIL PROTECTED]
Subject: [R] placing labels in polygon center ?
Dear all,
is there any function to calculate the center of a polygon mass in R?
Actually I need
I didn't study your code, but regarding a function to rotate a
vector: Multiplication by an orthogonal matrix does that. You may know
that an orthogonal matrix is a matrix whose transpose is its inverse.
Thus, A is orthogonal if and only if (A %*% t(A)) = identity. One of
the simplest
Barry Rowlingson [EMAIL PROTECTED] provided
functions PolygonArea and PolygonCenterOfMass.
As an exercise in R programming, I thought why don't I vectorise these
and then see if it makes a practical difference.
Here are my versions of his functions. Somehow I ended up with a sign
error when I
I wrote:
I found myself wishing for a function to rotate a vector.
Is there one? I know about ?lag, but help.search(rotate)
didn't find anything to the point.
Here I was regarding a vector as a _sequence_.
The (one-step) rotation of c(u,v,w,x,y,z) is c(v,w,x,y,z,u).
This
Dear all,
is there any function to calculate the center of a polygon mass in R?
Actually I need to find the best location within polygons to place labels.
Thanks for any hint
Jens Oehlschlägel
--
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test\ ...{{dropped}}
Petr Pikal [EMAIL PROTECTED] wrote (embedded in much XML):
Not sure about efficency and it is not very general solution but
you maybe can use embed() function
It's an interesting suggestion, but I don't see *how*.
Here's the function I want, only I'd like it to be something built
Barry Rowlingson [EMAIL PROTECTED] wrote:
Do you want:
c(x[-1],x[1]) for a one-step 'rotation'?
That's just the kind of thing I did, except that it's ugly.
I've browsed src/main/subscript.c and got rather lost, but
it looks very much as though x[-1] starts by