[R] names in R list's

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Mon Sep 7 16:37:05 CEST 2015


You puzzle me. Why does someone who cannot figure out how to post an email in plain text after so many messages on this mailing list get all worried about access time for string indexing?

Environment objects have those properties. They do not solve all problems though, because they are rather heavyweight... you need a lot of lookups to pay for their overhead. R5 objects and the hash package both use them, but I have never found three need to use them. Yes, I do program in Perl so I know where you are coming from, but the vector-based name lookup used in R works quite effectively for data where the number of list items is short or where I plan to access every element as part of my data processing anyway.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On September 7, 2015 3:34:53 AM PDT, Witold E Wolski <wewolski at gmail.com> wrote:
>What is the access time for R lists given a name of list element, is it
>linear, log, or constant?
>
>Than what are to rules for names in R-lists
>
>That reusing names is possible makes me wonder.
>
>tmp <- as.list(c(1,2,3,4))
>names(tmp) = c("a","a","b","b")
>tmp
>tmp$a
>
>
>What I am looking for is a standard R data structure which will allow
>me
>for fast and name lookup.



More information about the R-help mailing list