title: Unable to set column names to a subset of a dataframe
body: <p>I run the following code, <code>p</code> is the dataframe loaded.</p>
  
  <pre><code>a &lt;- sort(table(p$Title))
  a1 &lt;- as.data.frame(a)
  tail(a1, 7)
  
                       a
  Maths               732
  Science             737
  Physics             737
  Chemistry           776
  Social Science      905
  null              57374
                    88117
  </code></pre>
  
  <p>I want to do some manipulations on the above dataframe result. I want to add column names to the dataframe. I tried the colnames function.</p>
  
  <pre><code>colnames(a1) &lt;- c("category", "count")
  </code></pre>
  
  <p>I get the below error:</p>
  
  <pre><code>Error in `colnames&lt;-`(`*tmp*`, value = c("category", "count")) : 
      attempt to set 'colnames' on an object with less than two dimensions
  </code></pre>
  
  <p>Please suggest.</p>