Question: maSigPro error PlotGroups [Error: (list) object cannot be coerced to type 'double']
gravatar for nicolas.descostes
9 months ago by
nicolas.descostes0 wrote:

Dear members,

I am going through an error in the function PlotGroups called itself from the function see.genes. The error says:

Error: (list) object cannot be coerced to type 'double'

Looking at the code, the error is coming from the first "if" condition when performing a conversion to numeric:

 if (!is.vector(data)) {
        if (summary.mode == "representative") {
            distances <- apply(as.matrix(dist(data, diag = TRUE,
                upper = TRUE)), 1, sum)
            representative <- names(distances)[distances == min(distances)]
            yy <- as.numeric(data[rownames(data) == representative,])
            sub <- paste("Representative:", representative)

For whatever reason, two representatives are found in my data. The variable "data" given to the PlotGroups function contains:


         name1_rep1    name1_rep2   name1_rep3   name1_rep4    name2_rep2
rowname1 14.86033  9.350926 12.91931 13.57376  9.949755
rowname2 38.83950 28.544932 35.68800 38.14696 36.865118
          name2_rep3   name2_rep4   name3_rep2   name3_rep3
rowname1  7.719168 10.73339  5.448163  4.704266
rowname2  22.794248 25.20720 14.747614 19.013076


Therefore, the calculated variable "distances" contains two equal distances which "as.numeric" does not like. I can modify the code to take only one but I would like your confirmation that I am understanding correctly the error.

Thank you.




ADD COMMENTlink modified 9 months ago • written 9 months ago by nicolas.descostes0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 327 users visited in the last hour