title: Is there a dictionary functionality in R
body: <p>Is there a way to create a "dictionary" in R, such that it has  pairs?
  Something to the effect of:</p>
  
  <pre><code>x=dictionary(c("Hi","Why","water") , c(1,5,4))
  x["Why"]=5
  </code></pre>
  
  <p>I'm asking this because I am actually looking for a two categorial variables function.</p>
  
  <p>So that if x=dictionary(c("a","b"),c(5,2))</p>
  
  <pre><code>     x  val
  1    a  5 
  2    b  2 
  </code></pre>
  
  <p>I want to compute x1^2+x2 on all combinations of x keys</p>
  
  <pre><code>     x1 x2 val1  val2  x1^2+x2
  1    a  a   5     5      30
  2    b  a   2     5      9
  3    a  b   5     2      27
  4    b  b   2     2      6
  </code></pre>
  
  <p>And then I want to be able to retrieve the result using x1 and x2. Something to the effect of:
  get_result["b","a"] = 9</p>
  
  <p>what is the best, efficient way to do this?</p>