sparse matrix - R Error in validObject(.Object) when running as script, but not in console -
the following code works fine in r console (r 3.3.0):
m = system.file("external/pores_1.mtx", package = "matrix") x = matrix::readmm(m)
i can put in script , runs fine in r console as:
source("test.r")
however, when execute rscript --vanilla test.r
or rscript test.r
, error:
error in validobject(.object) : invalid class “dgtmatrix” object: not valid 'mnumeric' class object calls: <anonymous> -> new -> initialize -> initialize -> validobject execution halted
i don't know if related specific function. guessing has how rscript works, used various other libraries , functions , have never seen this. idea happening?
i can confirm ... i'm getting exact same error when running script containing call glmnet()
. able trace matrix package, on glmnet depends.
i back-rev'd r version v3.3.3 -> v3.3.2 , error disappeared. checked sessioninfo()
between 2 , discovered version of matrix
package differed ... 1.2-8 (in v3.3.3) , 1.2-7.1 (in v3.3.2). confirm, replaced "ok" version of matrix (7.1) "broken" version , error returned.
i can confirm explicitly loading methods package via library(methods)
resolves error (somehow?), explains differing behavior between console call , rscript call command line.
so, appears have 2 work-arounds:
library(methods)
- back rev version of matrix 1.2-7.1.
neither super satisfactory ... i'd know what's going on matrix 1.2-8. maybe it'll bug-fixed in next version.
if you're interested, here sessioninfo()
:
r version 3.3.3 (2017-03-06) platform: x86_64-pc-linux-gnu (64-bit) running under: ubuntu 16.04.2 lts locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c [3] lc_time=en_us.utf-8 lc_collate=en_us.utf-8 [5] lc_monetary=en_us.utf-8 lc_messages=en_us.utf-8 [7] lc_paper=en_us.utf-8 lc_name=c [9] lc_address=c lc_telephone=c [11] lc_measurement=en_us.utf-8 lc_identification=c attached base packages: [1] stats graphics grdevices utils datasets base other attached packages: [1] glmnet_2.0-5 foreach_1.4.3 matrix_1.2-8 loaded via namespace (and not attached): [1] codetools_0.2-15 grid_3.3.3 iterators_1.0.8 methods_3.3.3 [5] lattice_0.20-35
Comments
Post a Comment