There seem to be two opposing yet valid viewpoints to the 
question of doing it right vs. compatibility with S-Plus.
Compatbility with older version of R is a third overlapping
possible goal.

There does not appear to be an overall statement of 
intent in R, but rather, this question and others are 
approached on a case by case basis.

Scoping is an example where R took the first route and the
feature in question is an example of the second.  There 
are undoubtedly many more possible examples.  

One possibility might be to do it right, by default, but have 
a package that, when loaded, gives you S-Plus compatibility (or
visa versa).  This would cover not only this feature but other
features where there was a desire to do it right.  Some things 
that are difficult to implement in two ways, such as scoping, 
would presumably not be handled by this but other simpler items 
such as the one in question could be.

--- 
Date: Fri, 17 Oct 2003 09:28:59 +0200 
From: Martin Maechler <[EMAIL PROTECTED]>
[ Add to Address Book | Block Address | Report as Spam ] 
To: <[EMAIL PROTECTED]> 
Cc: David James <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>,Peter Dalgaard <[EMAIL 
PROTECTED]> 
Subject: Re: [Rd] data() misbehaving inside a function 

 
 
>>>>> "KH" == Kurt Hornik <[EMAIL PROTECTED]>
>>>>> on Fri, 17 Oct 2003 09:04:40 +0200 writes:

>>>>> Peter Dalgaard writes:
>> David James <[EMAIL PROTECTED]> writes:
>>> Calls of the form data(package = pkg) inside a function 
>>> incorrectly fail ("pkg" is a local variable). For instance,
>>> 
>>> foo <- function(pkg) data(package = pkg)
>>> foo("base")
>>> Error in .find.package(package, lib.loc, verbose = verbose) :
>>> none of the packages were found

>> This is pretty much unavoidable if you want a function to accept
>> unquoted names. It's not in principle different from

>> women <- "airquality"
>> data(women)

>> not being equivalent to data("airquality"). Some functions (library(),
>> require(), demo()) have a character.only argument to prevent it, and I
>> suppose we should consider putting it on help() and data() as well.

KH> Or get rid of non-standard evaluation and educate users to use quoted
KH> strings where strings should be used.

and infuriate those who know and used the S language for more
than 15 years, where help(help) has always worked? 

Definitely not worth the pain (I *know* I'd hear ... comments from them!)!
I'd go for adding `character.only'.

Martin



_______________________________________________
No banners. No pop-ups. No kidding.
Introducing My Way - http://www.myway.com

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

Reply via email to