1

I have the following S3 method in package foo:

print.foo <- function(x, ...) # do sth

I would like to import that method in package bar but get the following warning:

object ‘print.foo’ is not exported by 'namespace:foo'

I tried importing the method using a standard @export and @exportS3Method base::print, which produces the following NAMESPACE in foo after running devtools::document():

S3method(base::print,foo)

Then I imported the method in bar using @importFrom foo print.foo.

Junitar
  • 763
  • 5
  • 10
  • Are you looking for [this](https://stackoverflow.com/q/15563640/8245406)? – Rui Barradas May 02 '22 at 08:22
  • Using `Depends: foo` in `bar` `DESCRIPTION` file fixes the problem but unless I got it wrong, it's not exactly what I wanted to do. I only wanted to attach that particular method to package `bar`, not to load the entire `foo` package, more so when the generic method I want to use is a `base` function. – Junitar May 02 '22 at 08:43

0 Answers0