Re: R-alpha: Recycling

Bill Venables (
Wed, 26 Feb 1997 09:26:45 +1030

Date: Wed, 26 Feb 1997 09:26:45 +1030
Message-Id: <>
From: Bill Venables <>
To: Jim Lindsey <>
Subject: Re: R-alpha: Recycling
In-Reply-To: <>

Jim Lindsey writes:

 > Recycling should be explicit, not implicit. rep() does that
 > for vectors. If it is not sufficient for all cases, maybe it
 > should be extended or a new function introduced. Then
 > recycling will only occur when it is clear that that is what
 > we want because we have used the recycling function.  Jim

Yes, but...  I think this amounts to introducing a scalar type,
(as in GLIM) which presently does not exist in R or S.  I take
you you still do not want to have to write x + rep(1, length(x))
instead of x + 1.  How about the case where n <- 1.  Do you still
want x + n to be legal or would you demand x + rep(n, length(x))?

Like most things John Chambers has devised, I think the recycling
rule has been pretty well thought out and the about the best
compromise reached, but it is a compromise.  It is interesting,
though, than in S version 4 where all lengths are not exact
aliquots of the longest the result is an error, not just a warning.

I don't plan to say any more on this issue, which I think has been
interesting, (somewhat surprisingly).

Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696
South AUSTRALIA.     5005.   Email:
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: