hashmap in R

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

hashmap in R

Qiang Li (Jonathan)
Hi friends on R list,

Have people tried to implement a hashmap in R? What is the generic way to implement a lookup table in R?

Best,
Jonathan

 
===============
Jonathan Qiang Li

===============


      ____________________________________________________________________________________

[[elided Yahoo spam]]
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: hashmap in R

Dieter Menne
Qiang Li (Jonathan <jonathanli_1999 <at> yahoo.com> writes:

> Have people tried to implement a hashmap in R? What is the generic way to
implement a lookup table in R?

By default, this is implicit, for example, when using named vectors.

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/51507.html

and ?environment

Dieter

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: hashmap in R

Earl F. Glynn
In reply to this post by Qiang Li (Jonathan)
"Qiang Li (Jonathan)" <[hidden email]> wrote in message
news:<[hidden email]>...
> Hi friends on R list,
>
> Have people tried to implement a hashmap in R? What is the generic way to
> implement a lookup table in R?

Does this help?

> x <- rnorm(4)
> names(x) <- c("a", "b", "c", "d")
> x
         a          b          c          d
-1.4122868  1.3588267 -0.5499391 -0.3581889
> x["d"]
         d
-0.3581889


efg
Earl F Glynn
Bioinformatics
Stowers Institute for Medical Research

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.