Re: [R] using a dictionary in R

2011-10-19 Thread p . pagel-lists
On Wed, Oct 19, 2011 at 11:06:21AM +0200, Eran Eidinger wrote: > Hi all, > > Is there a way to create a "dictionary" in R, such that it has > pairs? > Something to the effect of: > x=dictionary(c("Hi","Why","water") , c(1,5,4)) > x["Why"]=5 You can do that with named elements of a vector: > foo

[R] using a dictionary in R

2011-10-19 Thread Eran Eidinger
Hi all, Is there a way to create a "dictionary" in R, such that it has pairs? Something to the effect of: x=dictionary(c("Hi","Why","water") , c(1,5,4)) x["Why"]=5 In truth I'm looking two categorial variables function. So that if x=dictionary(c("a","b"),c(5,2)) x val 1 a 5 2 b 2 I want to c