[R] beginner Q: hashtable or dictionary?

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jan 30 04:32:40 CET 2006


Make a list of lists:

L <- list(a = list(a = 1, b = 2), b = list(a = 3, b = 4))
L[["a"]][["b"]]
L$a$b

On 1/29/06, Christos Hatzis <christos at nuverabio.com> wrote:
> I was wondering if there is an easy way to extend this to implement a 2-D
> hash, i.e. 2-way indexing?
>
> > x[["a"]][["b"]] <- "something"
>
> Thanks.
>
> Christos Hatzis
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of jim holtman
> Sent: Sunday, January 29, 2006 8:39 PM
> To: context grey
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] beginner Q: hashtable or dictionary?
>
> use a 'list':
>
>
> > x <- list()
> > x[['test']] <- 64
> > x[['next one']] <- c(1,2,3,4)
> > x
> $test
> [1] 64
>
> $"next one"
> [1] 1 2 3 4
>
> > x[['test']]
> [1] 64
> >
>
>
>
> On 1/29/06, context grey <mobygeek at yahoo.com> wrote:
> >
> > Hi,
> >
> > Is there something like a hashtable or (python) dictionary in R/Splus?
> >
> > (If not, is there a reason why it's not needed / typical way to
> > accomplish the same thing?)
> >
> > Thank you
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 247 0281
>
> What the problem you are trying to solve?
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list