title: Checking whether a row name exists in a data frame?
body: <p>I would like to address the rows of a data frame by a string name, and the table will be built sequentially. I want to do something like</p>
  
  <pre><code>&gt; mytab &lt;- data.frame(city=c("tokyo","delhi","lima"),price=c(9,8,7),row.names=1)
  &gt; mytab
        price
  tokyo     9
  delhi     8
  lima      7 
  &gt; # I can add a new row
  &gt; mytab["london",] = 8.5
  </code></pre>
  
  <p>I now need to check whether a row name already exists.</p>
  
  <pre><code>&gt; mytab["ny",]
  [1] NA
  </code></pre>
  
  <p>Is there anything better that I can do other than</p>
  
  <p><code>&gt; if (is.na(mytab["ny",])) { mytab["ny",]=9;}</code></p>
  
  <p>since a <code>NA</code> may possibly arise otherwise?</p>