Re: [Rd] data frame subset patch, take 2

From: Robert Gentleman <>
Date: Wed 13 Dec 2006 - 19:30:48 GMT


   We had the "names" discussion and, AFAIR, the idea that someone might misinterpret the output as suggesting that one could index by number, seemed to kill it. A more reasonable argument against is that names<- is problematic.

You can use $, [[ (with character subscripts), and yes ls does sort of do what you want (but sorts the values, not sure if that is good). I think it is also inefficient in that I believe it copies the CHARSXP's (not sure we really need to do that, but I have not had time to sort out the issues). And there is an eapply as well, so ls() is not always needed.

mget can be used to retrieve multiple values (and should be much more efficient than multiple calls to get). There is no massign (no one seems to have asked for it), and better design choice might be to vectorize assign.

best wishes


Vladimir Dergachev wrote:
> On Wednesday 13 December 2006 1:23 pm, Marcus G. Daniels wrote:

>> Vladimir Dergachev wrote:
>>>     2. It would be nice to have true hashed arrays in R (i.e. O(1) access
>>> times). So far I have used named lists for this, but they are O(n):
>> new.env(hash=TRUE) with get/assign/exists works ok.  But I suspect its
>> just too easy to use named lists because it is easy, and that has bad
>> performance ramifications for user code (perhaps the R developers are
>> more vigilant about this for the R code itself).

> Cool, thank you !
> I wonder whether environments could be extended to allow names() to work
> (altough I see that ls() does the same function) and to allow for(i in E)
> loops.
> thank you
> Vladimir Dergachev
> ______________________________________________
> mailing list
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024

______________________________________________ mailing list
Received on Fri Dec 15 13:22:59 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 15 Dec 2006 - 03:30:59 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.