0

The code is this:

gset <- ReadAffy()

pData(gset)

b1<-log2(exprs(gset))

boxplot(b1, col = 2:4)

str(exprs(gset))
List of 1
 $ : symbol gset

At the third line, I get this error"Error in log2(exprs(gset)): non-numeric argument to mathematical function".

I used the same code and the same data a few days ago without any problem but now I don't know what's wrong. I haven't changed anything.

Shapol46
  • 1
  • 3
  • 1
    `expres(gset)` has to be numeric in order to apply `log2()` function. What does it return when you write `class(exprs(gset))`? – R18 Mar 08 '18 at 13:51
  • 1
    It's going to be almost impossible to debug this without a reproducible example (which is hard because Affymetrix data sets are big). `str(exprs(gset))` would be useful. – Ben Bolker Mar 08 '18 at 14:02
  • It returns list. I used it last week and I had no problem. I don't understand what has changed. – Shapol46 Mar 08 '18 at 14:02
  • We don't know what has changed either, but it's guaranteed that **something** has changed - either your data, or these aren't **exactly** the same commands, or (less likely) you've updated the package and it doesn't work identically. Can you please *edit your question* to include the results of `str(exprs(gset))` ? – Ben Bolker Mar 08 '18 at 14:03
  • make sure you're starting in a clean R session (no unnecessary packages loaded etc.) – Ben Bolker Mar 08 '18 at 14:05
  • @shapol46 Put additional information in your question (not in comments), i.e. **edit your question!** Make your example [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – jogo Mar 08 '18 at 14:12
  • Actually, I have loaded many unnecessary packages. I open a new session and let you know. The commands are the same. The result of `str(exprs(gset))` is also the same error. I'll add it. – Shapol46 Mar 08 '18 at 14:14
  • I wrote an answer to my question but it isn't here. The problem was due to unnecessary packages but I don't know which one because I had loaded many. Thank you very much, @ Ben Bolker – Shapol46 Mar 08 '18 at 14:37

1 Answers1

0

In line with the idea of conflicting packages highlighted above, a possible explanation can come from the fact that the exprs function in the dplyr package masks the exprs function in the Biobase package since both of functions have the same name in both packages.

https://support.bioconductor.org/p/109128/#109719

I have solved the problem in my case by placing exprs=Biobase::exprs at the top of my script.

Charles
  • 161
  • 12