append data to dataFrame in R function
<p>I am trying to write an R function that adds a new row to an existing dataFrame.</p>

<p>Here is my code (R newbie here): </p>

<pre><code>    qRows &lt;- data.frame( RowQuery = character(0), "BackTest P&amp;L" = character(0), stringsAsFactors=FALSE)
    # add row to dataFrame
    qRows[nrow(qRows) + 1, ] &lt;- c("sp500(vwpc) | abc(30) | qcume",  "12%")

    #define function to add new row to dataFrame
    Q &lt;- function(data, y){
      data[nrow(data) + 1, ] &lt;- c(y,"88")
    }
    # run new function
    Q(qRows, "newQuery")
    #examine output: but no new row added
    qRows
</code></pre>

<p>The code runs without error, but no new row is added.</p>