Date: Tue, 25 Feb 1997 07:07:10 -0800 From: zt_taylor@pnl.gov (Z. Todd Taylor) Subject: Re: R-alpha: Recycling To: r-testers@stat.math.ethz.ch > I agree that recycling is useful. So are stretchy vectors. The problem > is debugging. Recycling can introduce insidious errors in straight > data analysis where little programming is involved. > 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 While I disagree that recycling should require explicit invocation, I note that R is currently more error-prone than S in this respect because it doesn't warn if the longer of two vectors is not an even multiple of the length of the shorter one (I'm still using version 0.15). In R: > x [1] 1 2 3 > y [1] 1 2 > x + y [1] 2 4 4 In S: > x [1] 1 2 3 > y [1] 1 2 > x + y [1] 2 4 4 Warning messages: Length of longer object is not a multiple of the length \ of the shorter object in: x + y Maybe the right approach is to invent a "pedantic" option or a "lint" option that, when activated, makes the R interpreter very picky and loud-mouthed about things like recycled or strechy vectors, partial name matching, and other horrors that also happen to be very useful. Once things are debugged, the option could be turned off. This seems better to me than reverting to bondage-and-discipline in the language itself. --Todd -- Z. Todd Taylor Pacific Northwest National Laboratory zt_taylor@pnl.gov =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 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: r-testers-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-