[R] cyclic dependency when building a package

Duncan Murdoch murdoch.duncan at gmail.com
Sun Nov 30 17:43:25 CET 2014


On 30/11/2014, 10:15 AM, Glenn Schultz wrote:
> Hi All, 
> 
> I am working on a package BondLab for the analysis of fixed income securities.  Building the package results in the following:
> 
> Error in loadNamespace(package, c(which.lib.loc, lib.loc)) : 
> cyclic namespace dependency detected when loading ‘BondLab’, already loading ‘BondLab’
> 
> 
> It occurs when I set the generic for the function mortgagecashflow.  Further if a function uses mortgagecashflow, similarly its generic, when set, causes the above error.  Other generics do not throw this error so I am quite sure it is mortgagecashflow.  The package and the code can be found on github.  
> https://github.com/glennmschultz/BondLab.git
> 
> I have been trying to figure this out for a couple of months to no avail. If anyone has familiarity with this issue I would certainly appreciate any help with the issue.
> 

I don't see why this would cause the error you saw, but when I look at
your DESCRIPTION file, I see:

Depends: termstrc, reshape2, ggplot2, lubridate, methods, plyr, grid, optimx

It's a good idea to strongly limit the number of "Depends" entries.
Each of those potentially causes a change to the user's search list, and
may break something.

It's much better to use "Imports" instead, because that makes the other
packages available to you, but doesn't put them in the search list.

Duncan Murdoch



More information about the R-help mailing list