Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2014 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/10018579 to your computer and use it in GitHub Desktop.
Save anonymous/10018579 to your computer and use it in GitHub Desktop.
A minimal example to create the "cyclic namespace dependency" error in R when creating and loading a package
setClass("myClass", slots=c(name="character", value="numeric"))
setGeneric("myMethod", function(object) standardGeneric("myMethod"))
setMethod("myMethod", "myClass", function(object) {
cat(object@name, "=", object@value)
})
myMethod <- function(x,y) {
return(x,y)
}
@giupo
Copy link

giupo commented Nov 19, 2014

Dear LORD! They should give you a Nobel prize! Thank you. I hate R when it comes to this 😄

@wligtenberg
Copy link

I also got caught by this one.
Even when they have a different number of arguments, this still causes the cyclic namespace error.
Thanks for the pointer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment