Skip to content
Prev 22385 / 63421 Next

Feature request: names(someEnv) same as ls(someEnv)

On 10/15/2006 4:15 PM, Robert Gentleman wrote:
I think there's an important difference between a hash table and a 
vector.  Order matters in a vector.  Right now, if "foo" is the third 
name, then x$foo is the third element, but that's not true in an 
environment, where "third element" just doesn't make sense.

It will also be strange that you can ask to see the names, but you can't 
set them (unless you also want to also extend "names<-" to work on 
environments).

If you do go ahead with this change, I'd suggest implementing it as a 
new method

  names.environment <- function(x) ls(x)

rather than doing it at the C level.  At least then it will be 
consistent with the man page.

Duncan Murdoch