[Rd] [ subscripting sometimes loses names (PR#8192)

atp@piskorski.com atp at piskorski.com
Wed Oct 19 21:46:31 CEST 2005


On Wed, Oct 19, 2005 at 02:33:50PM +0200, Martin Maechler wrote:

> Proper R bug reports provide short "cut & paste" executable
> example code {i.e. no prompt, no output} or at least the 
> transcript of such code {transcript : input (+ prompt) + output}.

My patch includes the function dtk.test.brace.names() which
demonstrates the problem.  If you source just that function into a
completely stock R, you can see the losing names problem by running:

  dtk.test.brace.names(return.results.p=T ,only="all")

To make it easier to see just what the problem is, I'll send example
output in my next email.

> Also your script is for R and S-plus and at least in some places 
> it seems you think R has a bug because it behaves differently
> than S or S-plus.   

No, I don't think that.  If comments in my code give that impression
then that's a bug in my comments, it was not my intention.

My coworkers and I originally fixed the name losing problem in S-Plus,
then later did so in R, so in some places I might have sloppily said,
"R is different than S-Plus" when what I REALLY meant was, "Stock R is
different than our fixed/patched S-Plus where we've already solved
these name-losing problems."

Stock S-Plus and R both suffer from losing names when they shouldn't.
Since I use both dialects, I've included (ugly) fixes for both.  Of
course you probably only care about the R part, but I didn't think it
would hurt to include both.

> Now I'm sure you know from the R-FAQ that there are quite a few
> intentional differences between the two dialects of S,

Yes, I'm aware of that FAQ.  I also just finished porting a large body
of code from S-Plus to R a few months ago, so I have a very concrete
appreciation of the MANY little S-Plus vs. R differences, many more
than are mentioned in that FAQ.

Some of those differences are simply arbitrary or accidental, but
others are places where S-Plus was basically doing something dumb and
the R behavior is better.  I have no complaints about this.  :)

(The converse, where R's behavior is definitely inferior to that of
S-Plus, seems to be a lot less common, and are usually more minor.)

-- 
Andrew Piskorski <atp at piskorski.com>
http://www.piskorski.com/



More information about the R-devel mailing list