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?


1 Answer 1


My guess is you need to index matchedgeneTPM before you run lmFit(), not after:

fit <- lmFit(matchedgeneTPM[,-c(1:2)])
  • 1
    $\begingroup$ That worked, thanks! $\endgroup$
    – Feynman
    Jun 10, 2023 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.