[R] identify object that causes "Error in loadNamespace(name) : there is no package called ‘R.utils’"
mtmorgan at fhcrc.org
Wed Apr 24 16:12:33 CEST 2013
On 04/24/2013 06:03 AM, Duncan Murdoch wrote:
> On 13-04-24 5:46 AM, Liviu Andronic wrote:
>> Dear all,
>> I've bumped into the: "Error in loadNamespace(name) : there is no
>> package called ‘R.utils’" error. I've already read a bit on this (
>> http://www.cybaea.net/Blogs/Data/A-warning-on-the-R-save-format.html )
>> but I have a follow-up question.
>> Given a workspace that automatically loads a package that I don't
>> really need/want (e.g. ‘R.utils’), how do I identify which object
>> requires this package to load? I would like to avoid loading ‘R.utils’
>> every time I open an R session.
> That's not easy, because the code in R that triggers that error has no idea of
> the name of the object it is loading.
Maybe traceback() can provide some hints? I did, more or less arbitrarily
a = list(fun=ie.setup)
and then in a new session
Error in loadNamespace(name) : there is no package called 'rms'
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
4: tryCatchList(expr, classes, parentenv, handlers)
3: tryCatch(loadNamespace(name), error = function(e) stop(e))
2: getNamespace(c("rms", "3.6-3"))
with the line numbered 2 giving me the necessary hint.
> You could try a binary search to find out, but it will be tedious:
> 1. Install R.utils.
> 2. Load the workspace successfully.
> 3. Delete half the objects, and save it.
> 4. Uninstall R.utils, and see if you can load the workspace.
> At this point you'll know if there's an object needing R.utils still left or
> not, and you can repeat the steps until you find a single object that causes the
> problem. (But it might not be the only one, so deleting it from the original
> workspace might not solve your problem.)
> A better approach is to *never* save and load workspaces unless you know exactly
> what is in them. Always reply "no" to the question about saving your workspace
> (or set that as the default). If you accidentally end up with a workspace being
> loaded, delete it.
> Duncan Murdoch
>> R version 2.15.3 (2013-03-01)
>> Platform: i686-pc-linux-gnu (32-bit)
>>  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>>  LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
>>  LC_PAPER=C LC_NAME=C
>>  LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8
>> attached base packages:
>>  datasets grDevices splines graphics utils stats
>> methods base
>> other attached packages:
>>  R.utils_1.23.2 R.oo_1.13.0 R.methodsS3_1.4.2
>> tables_0.7.57 reshape2_1.2.2
>>  car_2.0-15 nnet_7.3-6 MASS_7.3-23
>> Hmisc_3.10-1 survival_2.37-2
>>  foreign_0.8-53
>> loaded via a namespace (and not attached):
>>  cluster_1.14.3 grid_2.15.3 lattice_0.20-13 plyr_1.8
>>  stringr_0.6.2 tools_2.15.3
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
More information about the R-help