[R] cyclic dependency error

Guy Brock guy.brock at louisville.edu
Thu Dec 13 16:09:47 CET 2007

I deleted the file zzz.R from the R subdirectory which contained the following:

## startup file for clValid package
#.First.lib <- function(libname, pkgname, where) {
#  if( !require(methods) ) stop("we require methods for package clValid")
#  where <- match(paste("package:", pkgname, sep=""), search())
#  .initClValid(where)

and the problem went away.  I'm not sure, though, why this would have any effect ...

Anyway, problem solved!


>>> "Guy Brock" <guy.brock at louisville.edu> 12/10/2007 12:25 AM >>>

Dear all, 
I am encountering a cyclic dependency error when running R CMD check on an R package I wrote (R version 2.6.1, Mac OS X 10.4), see the error message below.    

Creating a new generic function for "print" in "clValid"
Creating a new generic function for "summary" in "clValid"
Creating a new generic function for "plot" in "clValid"
Error in loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) : 
        cyclic name space dependencies are not supported
Error : package/namespace load failed for 'clValid'
Error: unable to load R code in package 'clValid'
Execution halted
ERROR: lazy loading failed for package 'clValid'
** Removing '/Users/guybrock/Documents/projects/DattaPackages/Cluster/clValid_0.5-4.Rcheck/clValid'

The NAMESPACE file is below,

.onLoad <- function(lib, pkg) require(methods)
importFrom(graphics, plot)
exportMethods(clusters, clusterMethods, nClusters, measNames, measures, optimalScores, plot, print, show, summary)
export(clValid, sota, dunn, connectivity, BHI, BSI, stability, matchGO)

My question is - how can I locate the source of the cyclic dependency error?  This is an updated version of a package which did not previously have this error, so somehow I introduced this in the modifications I made.  Note that R CMD check on Windows (R version 2.6.0) doesn't catch this, although R CMD build --binary fails on Windows with the same error.   


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.

More information about the R-help mailing list