Metabolomics Society Forum

Software => R => XCMS => Topic started by: tomas.mikula on May 07, 2013, 04:47:26 PM

Title: Error in diffreport -> pval: missing "drop=FALSE"
Post by: tomas.mikula on May 07, 2013, 04:47:26 PM
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
Title: Re: Error in diffreport -> pval: missing "drop=FALSE"
Post by: sneumann on May 23, 2013, 02:00:30 PM
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
Title: Re: Error in diffreport -> pval: missing "drop=FALSE"
Post by: tomas.mikula on May 23, 2013, 04:38:42 PM
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.
Title: Re: Error in diffreport -> pval: missing "drop=FALSE"
Post by: sneumann on May 26, 2013, 03:40:23 PM
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