[R] generating a sequence
Jonathan Rougier
J.C.Rougier at durham.ac.uk
Tue Dec 21 15:54:07 CET 1999
On Tue, 21 Dec 1999, Prof Brian Ripley wrote:
> I am a bit puzzled here. Why is that n=5 not n=4? Anyway, try
>
> A <- matrix(1, n-1, n-1)
> rA <- row(A)
> rA[rA + col(A) <= n]
Or, in the festive spirit,
n <- 5
rA <- outer(1:n, 1:n, "-")
rA[rA>=1]
Cheers, Jonathan.
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
"[B]egin upon the precept ... that the things we see are to be
weighed in the scale with what we know" (Meredith, 1879, The Egoist)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list