Skip to main content
Topic: Error in diffreport -> pval: missing "drop=FALSE" (Read 4263 times) previous topic - next topic

Error in diffreport -> pval: missing "drop=FALSE"

When I run diffreport on two classes where one of them has just 1 sample and the other one has at least 2 samples, I get this error:
Code: [Select]
Error in rowSums(!is.na(X[, classlabel == 1])) : 
  'x' must be an array of at least two dimensions
Calls: diffreport -> diffreport -> .local -> pval -> rowSums
The problem is that with one sample in a class, the expression X[, classlabel == 1] results in a vector. The solution is to add drop=FALSE

Note: it doesn't happen when each class has exactly 1 sample, since in that case T-test and p-value are not calculated at all.

This is xcms 1.36.0

Re: Error in diffreport -> pval: missing "drop=FALSE"

Reply #1
Hi Tomas,

Thanks for reporting this. But wouldn't the better solution
be to skip the t-test if /any/ of the classes have only one sample ?

Yours,
Steffen
--
IPB Halle                          Mass spectrometry & Bioinformatics
Dr. Steffen Neumann         http://www.IPB-Halle.DE
Weinberg 3 06120 Halle     Tel. +49 (0) 345 5582 - 1470
sneumann(at)IPB-Halle.DE

Re: Error in diffreport -> pval: missing "drop=FALSE"

Reply #2
Thanks Steffen for your reply.

You are probably right, I'm not sure how much sense it makes to calculate t-test for a class of size 1.

 

Re: Error in diffreport -> pval: missing "drop=FALSE"

Reply #3
Hi Tomas,

I have added an additional check to skip t-test if
any of the classes has less than 2 samples to 1.37.4

Yours,
Steffen
--
IPB Halle                          Mass spectrometry & Bioinformatics
Dr. Steffen Neumann         http://www.IPB-Halle.DE
Weinberg 3 06120 Halle     Tel. +49 (0) 345 5582 - 1470
sneumann(at)IPB-Halle.DE