[R] beginner Q: hashtable or dictionary?

Warnes, Gregory R gregory.r.warnes at pfizer.com
Wed Feb 1 18:27:44 CET 2006


Standard R vectors and list elements can given names, and can be accessed by them.  This allows them to be used like the dictionaries or hashes of other languages.

For example

>  x = c("a"=1, "b"=2, "c"=3)
>  x["a"]
a 
1 
> x["foo"] = "bar"
> x["foo"]
  foo 
"bar" 
> x
    a     b     c   foo 
  "1"   "2"   "3" "bar" 

-Greg

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of context grey
> Sent: Sunday, January 29, 2006 8:35 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] beginner Q: hashtable or dictionary?
> 
> 
> 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
> 
----------------------------------------------------------------------
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}




More information about the R-help mailing list