Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warnings when reloading packages with S4 classes #141

Closed
wch opened this issue Aug 14, 2012 · 9 comments
Closed

Warnings when reloading packages with S4 classes #141

wch opened this issue Aug 14, 2012 · 9 comments

Comments

@wch
Copy link
Member

wch commented Aug 14, 2012

I get these warnings error when loading lubridate.

I think there are two issues.

  • One is in unloadNamespace -> cacheMetaData -> .getGenerics -> .removeSuperclassBackRefs
  • One is in unloadNamespace -> cacheMetaData -> .getGenerics -> .removeSuperclassBackRefs -> findClass, but I'm not yet sure where.

The first type of of warning only happens the second time a package is loaded with load_all(, TRUE). The second type of warning seems to happen every time except the first.

> load_all('lubridate', TRUE)
Loading lubridate

> load_all('lubridate', TRUE)
Loading lubridate
Warning messages:
1: In .removeSuperclassBackRefs(Class, classDef, classWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Duration"
2: In .removeSuperclassBackRefs(Class, classDef, classWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Interval"
3: In .removeSuperclassBackRefs(Class, classDef, classWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Period"
4: In FUN(X[[2L]], ...) :
  Created a package name, ‘2012-08-14 16:06:15’, when none found
5: In .removeSuperclassBackRefs(cl, cldef, searchWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Duration"
6: In .removeSuperclassBackRefs(cl, cldef, searchWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Interval"
7: In .removeSuperclassBackRefs(cl, cldef, searchWhere) :
  could not find superclass "EnumerationValue" to clean up when removing subclass references to class "Period"


> load_all('lubridate', TRUE)
Loading lubridate
Warning message:
In FUN(X[[2L]], ...) :
  Created a package name, ‘2012-08-14 16:07:25’, when none found

The package seems to work, though -- it passes all tests.

@wch
Copy link
Member Author

wch commented Aug 16, 2012

Fixed and merged in 9330614. A second part needed fixing, at f57967a.

I changed it use importing code from loadNamespace. This also made it import packages and objects list in the NAMESPACE file, in the same way that they are loaded when using library().

Now the DESCRIPTION file isn't used to actually import packages, although it is still used to check version numbers.

@wch wch closed this as completed Aug 16, 2012
@garrettgman
Copy link

Winston,

What was up here? I'm getting some of the behavior you describe above:

> library(devtools)
> devtools::test()

(the test output - everything passes)

Warning message:
In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-12-17 11:06:29’, when none found

It's spooky that a date is involved, but I'm guessing that it's not a lubridate thing. Also, the warning message does not always appear, and it sometimes appears for load_all() -- even though the package loads fine.

@wch
Copy link
Member Author

wch commented Dec 17, 2013

Oh yeah, I've seen this again recently. The date isn't a lubridate thing - I believe it has something to do with R's handing of .removeSuperclassBackRefs. Sorry I don't have more insight on it right now!

@wch
Copy link
Member Author

wch commented Dec 18, 2013

Garrett - which package are you using when you see this?

With Shiny, this warning comes up now when you reload a package. It was introduced in rstudio/shiny@8d8ea53,

The problem is import(methods) in NAMESPACE. When that line is removed, reloading works fine.

@wch
Copy link
Member Author

wch commented Dec 18, 2013

One more thing I just remembered: John Chambers suggests putting methods into the Depends field instead of importing it. It's the third message in this thread:
http://r.789695.n4.nabble.com/advise-on-Depends-td4678930.html

@garrettgman
Copy link

Winston,

I was using lubridate, of course :)

It's good to know that we can trace the problem to import(methods). Lubridate already lists methods in the dependency field. However, I add imports(methods) to pass R CMD check (it fails on a warning otherwise).

Is there an alternative way to use methods and pass CRAN's check?

@wch
Copy link
Member Author

wch commented Dec 19, 2013

I'm thinking now that you can leave imports(methods) - the issue is with devtools. There's something different about how S4 classes are created when using load_all(), as compared to loading a built package with library(). Hopefully I'll be able to get load_all() to behave more like library().

@hadley
Copy link
Member

hadley commented Mar 17, 2014

Does this still happen? Or is it fixed in recent R?

@wch
Copy link
Member Author

wch commented Mar 18, 2014

The "Created package name" warning seems to be gone on R 3.0.3, and R-devel (from about two weeks ago).

@garrettgman A heads up: on R-devel, I see these messages after the tests (but not on R 3.0.3):

Warning messages:
1: In Ops.factor(left, right) : - not meaningful for factors
2: In Ops.factor(left, right) : - not meaningful for factors
3: In Ops.factor(left, right) : - not meaningful for factors

@hadley hadley closed this as completed Mar 18, 2014
@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants