[R] odd feature
ivo welch
ivowel at gmail.com
Mon May 22 23:01:19 CEST 2006
Hi Thomas:
> One case where the vector-vector recycling rules are used is in
> vector-matrix operations:
> a<-1:4
> b<-diag(4)
> a+b
is this last expression intended to be intuitive and thus desirable?
if anything else, I would end up writing something like this more as
an error than by intent. I would suggest that recycling might be
better to be explicitly asked for by the user---though I am not sure
what the syntax should be.
allow.recycle(a+b)
at the end, I think implicit recycling is a tradeoff between
convenience and unintended errors. I would judge the convenience of
implicit recycling to be fairly low, and the unintended error rate
[with difficulty finding it] to be fairly high.
I guess the R language has few options() that control its
behavior---e.g., ala "use strict;" in perl. If it did, I would love
to turn off implicit recycling, provided there is an explicit recycle
possibility. I would not mind having the ability to be forced to
define variables first, either, though this is not a big deal. R is
pretty good in telling me when I use variables that have not been
defined.
regards,
/ivo
>
>
> -thomas
>
More information about the R-help
mailing list