Rcheck: Warning: replacing previous import

Hey guys,

I have a package that loads two other packages that have export the same RefClass. In detail,

First package: Qs1API

...
API <- function(...) {
  tmpObj <- methods::new(getClassDef(".API", package = "Qs1API", inherits = FALSE), ...)
  return(tmpObj)
}
...

Second package: Qs2API

...
API <- function(...) {
  tmpObj <- methods::new(getClassDef(".API", package = "Qs2API", inherits = FALSE), ...)
  return(tmpObj)
}
...

I know have a package called LoadeR that needs both packages. So basically, calling both APIs within the package seems to work with the presented way of using methods::new and getClassDef. However, I cannot execute an RCheck successfully. That is, I get the warning

W  checking whether package ‘LoadeR’ can be installed (5.6s)
   Found the following significant warnings:
     Warning: replacing previous import ‘Qs1API::API’ by ‘Qs2API::API’ when loading ‘LoadeR’
...
0 errors ✔ | 1 warning ✖ | 2 notes ✖
Error: R CMD check found WARNINGs
Execution halted

Honestly, I don't understand why R appears to have a problem with two class method names coming from different namespace - In my opinion, this is exactly the use case for annotation with namespaces.

Any ideas how to resolve this without disabling all warnings?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.