title: A comprehensive survey of the types of things in R; 'mode' and 'class' and 'typeof' are insufficient
body: <p>The language R confuses me. Entities have <em>modes</em> and <em>classes</em>, but even this is insufficient to fully describe the entity.</p>
  
  <p>This <a href="https://stackoverflow.com/questions/6258004/r-types-and-classes-of-variables">answer</a> says</p>
  
  <blockquote>
    <p>In R every 'object' has a mode and a class.</p>
  </blockquote>
  
  <p>So I did these experiments:</p>
  
  <pre><code>&gt; class(3)
  [1] "numeric"
  &gt; mode(3)
  [1] "numeric"
  &gt; typeof(3)
  [1] "double"
  </code></pre>
  
  <p>Fair enough so far, but then I passed in a vector instead:</p>
  
  <pre><code>&gt; mode(c(1,2))
  [1] "numeric"
  &gt; class(c(1,2))
  [1] "numeric"
  &gt; typeof(c(1,2))
  [1] "double"
  </code></pre>
  
  <p>That doesn't make sense. Surely a vector of integers should have a different class, or different mode, than a single integer? My questions are:</p>
  
  <ul>
  <li>Does everything in R have (exactly one) <em>class</em> ?</li>
  <li>Does everything in R have (exactly one) <em>mode</em> ?</li>
  <li>What, if anything, does 'typeof' tell us?</li>
  <li>What other information is needed to fully describe an entity? (Where is the 'vectorness' stored, for example?)</li>
  </ul>
  
  <p><strong>Update</strong>: Apparently, a literal 3 is just a vector of length 1. There are no scalars. OK But... I tried <code>mode("string")</code> and got <code>"character"</code>, leading me to think that a string was a vector of characters. But if that was true, then this should be true, but it's not! <code>c('h','i') == "hi"</code></p>