dREG icon indicating copy to clipboard operation
dREG copied to clipboard

Error in if (class(x) == "BigMatrix.refer") bigm.internal.nrow(x) else NROW(x) : the condition has length > 1

Open Valravn4 opened this issue 1 year ago • 3 comments

Running the test program with R 4.2.2 gives the error in the title and attached below. error.txt

`R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
 [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C           
 [4] LC_COLLATE=C         LC_MONETARY=C        LC_MESSAGES=C       
 [7] LC_PAPER=C           LC_NAME=C            LC_ADDRESS=C        
[10] LC_TELEPHONE=C       LC_MEASUREMENT=C     LC_IDENTIFICATION=C 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] Rgtsvm_0.55          dREG_1.4.0           randomForest_4.7-1.1
 [4] mvtnorm_1.1-3        rmutil_1.1.10        data.table_1.14.8   
 [7] snowfall_1.84-6.2    snow_0.4-4           rphast_1.6.9        
[10] e1071_1.7-13         bigWig_0.2-9        

loaded via a namespace (and not attached):
[1] class_7.3-21   tools_4.2.2    bit64_4.0.5    bit_4.0.5      proxy_0.4-27  
[6] parallel_4.2.2 compiler_4.2.2`

Valravn4 avatar Mar 31 '23 18:03 Valravn4

hello, Have you solved this problem?I met a similar problem. thanks a lot!

best, Yu

liuyu988 avatar Jun 05 '23 09:06 liuyu988

I met the problem, too.  I also test the svm_iris<- Rgtsvm::svm(Species ~ ., data=iris), getting the error: 

Error in if (class(x) == "data.frame") x <- as.matrix(x) : the condition has length > 1 Warning message: In !sparse && (class(x) %in% c("matrix", "data.frame")) : 'length(x) = 2 > 1' in coercion to 'logical(1)' Thanks a lot!

Mao-young avatar Dec 01 '23 08:12 Mao-young

I also met the same problem when using dReg on R > v4.0.

This is due to a difference in the way class(x) is output for matrices in R > v4.0, so that class(x) returns a vector of length 2: "matrix" "array". This leads to the error "the condition has length > 1"

dReg runs without this error on R 3.6.3 or earlier, so the simplest solution is to create a Conda environment with R 3.6.3 pinned and install all other dependencies there

SLundregan avatar Dec 07 '23 09:12 SLundregan