[R] Ignoring loadNamespace errors when loading a file
Allan Engelhardt
allane at cybaea.com
Mon Aug 22 08:52:27 CEST 2011
On a Unix machine I ran caret::rfe using the multicore package, and I
saved the resulting object using save(lm2, file = "lm2.RData").
[Reproducible example below.]
When I try to load("lm2.RData") on my Windows laptop, I get
Error in loadNamespace(name) : there is no package called 'multicore'
I completely understand the error and I would like to ignore it and
still load the saved object data.
I imagine that I can make myself an empty multicore package for Windows
and load the data file successfully, but is there another way?
(I am not going to use any multicore functionality; I just want to
inspect some of the data stored in the object and the reference in
question is just an unfortunately stored link from the original call.)
(I did search for this question in the archives, but could only find it
discussed in connection with starting R with a .RData file where the
consensus seems to be to start R in vanilla mode and install the missing
package. This situation is different and installing a Unix-only package
on Windows is obviously a non-starter, except as I proposed above.)
Obligatory reproducible example: On the Unix machine do
library("multicore")
a <- list(data = 1:10, fun = mclapply)
save(a, file = "a.RData")
and then try to load the "a.RData" file on Windows. The question is if
I can recover the data (1:10) on that platform.
Allan
> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] compiler stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] caret_4.98 cluster_1.14.0 reshape_0.8.4 plyr_1.6
[5] lattice_0.19-31 boot_1.3-2 ctv_0.7-3
loaded via a namespace (and not attached):
[1] grid_2.13.1 tools_2.13.1
More information about the R-help
mailing list