[Rd] data frame subset patch, take 2

Robert Gentleman rgentlem at fhcrc.org
Wed Dec 13 20:30:48 CET 2006


Hi,
   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
   Robert





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
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
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
206-667-7700
rgentlem at fhcrc.org



More information about the R-devel mailing list