R-alpha: Re: R-0.15: problem with dimnames<-() --- x[[i]] <- NULL

Martin Maechler (maechler@stat.math.ethz.ch)
Tue, 7 Jan 97 10:04:59 +0100


Date: Tue, 7 Jan 97 10:04:59 +0100
Message-Id: <9701070904.AA01283@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: ihaka@stat.auckland.ac.nz
In-Reply-To: <199701070157.OAA16344@stat13.stat.auckland.ac.nz> (message from
Subject: R-alpha: Re: R-0.15: problem with dimnames<-() ---   x[[i]] <- NULL

>>>>> "Ross" == Ross Ihaka <ihaka@stat.auckland.ac.nz> writes:

    Ross> Kurt Hornik writes:
    >> The following problem exists:
    >> 
    R> x <- matrix(1:4, 2, 2) x
    >> ........
    Ross> ......... much omitted .....

    Ross> This is why I'm not totally happy about the use of x[[i]] <- NULL
    Ross> to remove the i-th component of x.  It makes more sense to me to
    Ross> have x[[i]] make the i-th component be NULL and to have
    Ross> x[i]<-NULL remove the ith component.  This is in the spirit of
    Ross> "[[" manipulating things in a list while "[" manipulates the list
    Ross> itself.  In S it appears that "[<-" is a no-op for lists.

Already last time you mentioned this,
I said to myself "this would be a place, where  R should improve on S
		  with the price of being incompatible"..
Does anybody know of  any S packages / functions
which make use of this "misfeature"?

If there are only very few,  I think you should adopt your proposal
which really makes much more sense!
[[and add a note in $RHOME/README  which lists differences  R <-> S]].

Well, then, after some time, people will start sending bug reports to
StatSci/Mathsoft, complaining about the unreasonable behavior of Splus
which is even incompatible with R  ;-)

-- Martin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-