title: How to change column names of a dataframe using rpy2
body: <p>I want to do the equivalent of this R code:</p>
  
  <pre><code>m2 &lt;- cbind(1,2)
  colnames(m2) &lt;- c("x","Y")
  </code></pre>
  
  <p>When I do </p>
  
  <pre><code>import rpy2.robjects as R
  m2 = R.r['cbind'](1,2)
  R.r['colnames'](m2) = R.StrVector(['x','y'])
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>SyntaxError: can't assign to function call
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>&gt;&gt;&gt; m2 = R.r['colnames'](m2, R.StrVector(['x','y']))
  &gt;&gt;&gt; print m2
  
  [1] "x1" "y2" 
  </code></pre>
  
  <p>And</p>
  
  <pre><code>&gt;&gt;&gt; params = {'do.NULL':False}
  &gt;&gt;&gt; m2 = R.r['colnames'](R.StrVector(['x','y']), m2, **params)
  &gt;&gt;&gt; print m2
  
  [1] "11" "21"
  </code></pre>
  
  <p>Which both don't give the result that I want. So how can I use colnames to change the column names of a dataframe?</p>