[R] Dictionaries with integer indices

From: Ross Boylan <ross_at_biostat.ucsf.edu>
Date: Tue 14 Feb 2006 - 08:24:11 EST

Some past threads have pointed out that lists can be used as dictionaries storing data with an associated key (environments do this too).

I have the seemingly simpler case with integer values for the indices--however, the integers are not necessarily contiguous low numbers. My concern is that if id is 3000 then d <- list()
d[[id]] <- some data

and later retrieval with
is going to be wasteful (e.g., produce something with 3000 elements).

I could turn id into a string, but that seems pretty indirect.

Is there any problem with the naive scheme outlined above? If so, what's a good way around it?

Ross Boylan                                      wk:  (415) 514-8146
185 Berry St #5700                               ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics           fax: (415) 514-8150
University of California, San Francisco
San Francisco, CA 94107-1739                     hm:  (415) 550-1062

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Feb 14 08:35:16 2006

This archive was generated by hypermail 2.1.8 : Wed 15 Feb 2006 - 13:31:04 EST