convert factor and character to numeric in a dataframe
<p>I have a dataframe that I am trying to filter.  Here is the structure:</p>

<pre><code>'dataframe': 45 obs. of 1450 variables:
$ X01493112  :Factor w/ 47 levels "01493112", "0145769",...
..- attr(*, "names")= chr "510130020" "510360002"
</code></pre>

<p>I have a feeling I can't filter it because I have factors and characters but I cannot convert it to numeric. I have tried:</p>

<pre><code>as.numeric.factor &lt;- function(x) {as.numeric(levels(x))[x]}
df2 &lt;- as.numeric.factor(df1)
</code></pre>

<p>and numerous other conversions but I can't figure out why it won't work, when I call the new df I get</p>

<pre><code>&gt;numeric(0)
</code></pre>