error in perf function

Issue #106 resolved
Former user created an issue

Dear mixOmics developer I have met a weird issue on my Mac system. I am working on a metabolites data analysis on a case and control study. I imported my data set and run plsda function.

Here is the code I used. 
rownames(POSnorm)<-POSnorm$row.ID
wholeX<-as.data.frame(t(POSnorm[,-c(1:7)])) 
whole.plsda.res.pos <- plsda(wholeX, Y, ncomp = 5) 
perf.whole.plsda.res.pos <- perf(whole.plsda.res.pos, validation = "Mfold", folds = 5, progressBar = FALSE, auc = TRUE, nrepeat = 10)

Error in if (ncol(newx) != p & ncol(newx) != length(A)) { : argument is of length zero

I followed the the example (sPLSDA: SRBCT) on mixOmics website. Once I conducted the perf function as the same as above, I will get the same error message when I rerun the example R script from sPLSDA:SRBCT example. Other functions works well, excepting for the perf function.

Not sure what is happening for this weird issue. If I restart R and conduct the example code, it works fine. After I run my script and rerun the example, it will got the same error message again.

The interesting thing is when I run my R script on Windows system, it will not show any error message. I tried on my both MacbookPro and iMac, and they all have the same issue. I tried to upgrade the R version, but it does not work as well. Any suggestions?


R version: platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 4.1
year 2017
month 06
day 30
svn rev 72865
language R
version.string R version 3.4.1 (2017-06-30) nickname Single Candle

Comments (5)

  1. Florian Rohart

    Dear Raydai,

    Thanks for your message!

    It seems to me that this is a clash with another package. Two indications:

    1. we don't have a "newx" object in any of the mixOmics code,

    2. " If I restart R and conduct the example code, it works fine. After I run my script and rerun the example, it will got the same error message again"

    I would say that you are loading another package in your script, not sure why it doesn't clash when you're running it on windows though.

    If I'm correct, could you let me know the package name please? If you can't pinpoint which one clashes, a sessionInfo() should be sufficient.

    Thanks!

  2. Former user Account Deleted reporter

    Hi Florian,

    Thanks for your reply.

    Sorry, I forgot the list the whole packages I loaded in R. I list them below. Please let me know if you need more information from me.

    R version 3.3.3 (2017-03-06)
    Platform: x86_64-apple-darwin13.4.0 (64-bit)
    Running under: OS X El Capitan 10.11.6
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     
    
    other attached packages:
    [1] DT_0.2          tidyr_0.7.0     dplyr_0.7.2     readxl_1.0.0    specmine_1.0    mixOmics_6.2.0  ggplot2_2.2.1  
    [8] lattice_0.20-35 MASS_7.3-47    
    
    loaded via a namespace (and not attached):
     [1] rgl_0.98.1              Rcpp_0.12.12            corpcor_1.6.9           hyperSpec_0.98-20161118
     [5] assertthat_0.2.0        digest_0.6.12           foreach_1.4.3           mime_0.5               
     [9] R6_2.2.2                cellranger_1.1.0        plyr_1.8.4              MatrixModels_0.4-1     
    [13] stats4_3.3.3            ellipse_0.3-8           rlang_0.1.2             lazyeval_0.2.0         
    [17] caret_6.0-76            minqa_1.2.4             SparseM_1.77            car_2.1-5              
    [21] nloptr_1.0.4            Matrix_1.2-11           labeling_0.3            splines_3.3.3          
    [25] lme4_1.1-13             stringr_1.2.0           htmlwidgets_0.9         igraph_1.1.2           
    [29] munsell_0.4.3           shiny_1.0.5             httpuv_1.3.5            pkgconfig_2.0.1        
    [33] mgcv_1.8-18             htmltools_0.3.6         Metrics_0.1.2           nnet_7.3-12            
    [37] tibble_1.3.4            codetools_0.2-15        ModelMetrics_1.1.0      grid_3.3.3             
    [41] nlme_3.1-131            jsonlite_1.5            xtable_1.8-2            gtable_0.2.0           
    [45] magrittr_1.5            scales_0.5.0            stringi_1.1.5           reshape2_1.4.2         
    [49] bindrcpp_0.2            latticeExtra_0.6-28     pls_2.6-0               RColorBrewer_1.1-2     
    [53] spls_2.2-1              iterators_1.0.8         tools_3.3.3             svUnit_0.7-12          
    [57] glue_1.1.1              purrr_0.2.3             parallel_3.3.3          pbkrtest_0.4-7         
    [61] colorspace_1.3-2        knitr_1.17              bindr_0.1               quantreg_5.33   
    
  3. Florian Rohart

    Hi Raydai,

    Thanks for the answer! It's probably a clash with the pls and/or spls packages. Try to run your code without loading these packages if you can.

    Can I ask what functions/functionality of these packages are you using that are not in mixOmics?

    We'll try to fix your problem in future updates

    Thanks!

  4. Former user Account Deleted reporter

    Thanks for your help. I only load "mixOmics" and "readxl", and It works well now. Not sure where is the clash came from which package.

    library("mixOmics")
    library("specmine")   # Use for metabolomics data analysis(data pretreatment, such as normalization, scaling, deal with your missing values)
    library("readxl")         # for importing excel document
    library("dplyr")           # for data manipulation
    library("tidyr")            # for data manipulation
    library("DT")               # DataTables library. I use Rmarkdown to generate my study report, this package to generate tables on HTML with some functions of filtering, pagination, sorting, and many other features in the tables.
    

    I appreciate you help.

  5. Log in to comment