<p>My guess is you need to index <code>matchedgeneTPM</code> before you run <code>lmFit()</code>, not after:</p>
<pre><code>fit &lt;- lmFit(matchedgeneTPM[,-c(1:2)])
</code></pre>

CC BY-SA 4.0
2023-06-10T20:43:05.713Z
That worked, thanks!
Feynman
CC BY-SA 4.0
2023-06-10T14:09:01.413Z
2023-06-10T14:09:01.413Z
user438383
<p>I'm trying to conduct <code>lmFit</code> on my <code>fread::table</code> matrix:</p>
<pre class="lang-r prettyprint-override"><code>fit &lt;- lmFit(matchedgeneTPM)[,-c(1,2)]
</code></pre>
<p>It's giving me the error that expression object should be numeric and that there are 2 non-numeric columns (because the first two columns are the labels of the genes and gene ID's I'm working with). I thought the last portion of my code would allow it to skip over the first two columns but apparently it's not the right way to do it. Can someone show me how to format the code correctly, please?</p>

<r><rna><limma>
How do I fix this limma line?
# How do I fix this limma line?

(Asked by: username_0 on 2023-06-10)

I'm trying to conduct lmFit on my fread::table matrix:
fit <- lmFit(matchedgeneTPM)[,-c(1,2)]

It's giving me the error that expression object should be numeric and that there are 2 non-numeric columns (because the first two columns are the labels of the genes and gene ID's I'm working with). I thought the last portion of my code would allow it to skip over the first two columns but apparently it's not the right way to do it. Can someone show me how to format the code correctly, please?

**Tags:** r, rna, limma

---

## 1 answers

### Answer by username_1 on 2023-06-10. Score: 2 | Accepted answer

My guess is you need to index matchedgeneTPM before you run lmFit(), not after:
fit <- lmFit(matchedgeneTPM[,-c(1:2)])

> **Comments:**
> **username_0**: That worked, thanks!  

---

