Why are my row names dropped and how to avoid it?
<p>I want to replace a certain string by another in a data frame
here is a sample code: </p>

<pre><code>table_ex &lt;- data.frame(row.names = c("row 1", "row 2", "row 3"))
table_ex$year1 &lt;- 3:1
table_ex$year2 &lt;- c("NaN", 5, "NaN %")
table_ex$year3 &lt;- c("NaN %", 7, "NaN %")

remove_symb &lt;- function(yolo){stringr::str_replace(yolo, 'NaN %|NaN', '')}
table_ex &lt;- mutate_all(table_ex, funs(remove_symb))
</code></pre>

<p>Doing the above is dropping my rownnames.  I understand I could use a lapply function, but I'm wondering why are the row names dropped.  Is it because of the <code>str_replace</code> functions or the <code>mutate_all</code> functions?  And how should I prevent that?</p>