Re: [R] beginner Q: hashtable or dictionary?

From: Warnes, Gregory R <gregory.r.warnes_at_pfizer.com>
Date: Thu 02 Feb 2006 - 04:27:44 EST

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@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch]On Behalf Of context grey
> Sent: Sunday, January 29, 2006 8:35 PM
> To: r-help@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@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}}

R-help@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 Received on Thu Feb 02 04:55:11 2006

This archive was generated by hypermail 2.1.8 : Thu 02 Feb 2006 - 08:29:51 EST