Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-10T20:43:05.713Z
Answers.Text: That worked, thanks!
Answers.UserDisplayName: Feynman
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-10T14:09:01.413Z
Answers.LastActivityDate: 2023-06-10T14:09:01.413Z
Answers.UserDisplayName: user438383
Body: <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>
  
Tags: <r><rna><limma>
Title: How do I fix this limma line?
ThreadText: # 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:
  
  ```r
  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!  
  
  ---
  
  