1

While researching this question, I found a previous discussion: Roxygen2 - how to properly document S3 methods

However, that discussion is several years old. It says you need to at least add @export to the methods. I have not been using @export for the methods and everything was fine. Starting with R 4.0.0, I get errors because the methods are not exported:

no applicable method for 'function_name' applied to an object of class "xxx"

Is this change of behavior documented somewhere? Why haven't I ran into problems previously?

burger
  • 5,683
  • 9
  • 40
  • 63
  • Have you tried reading [this section](https://r-pkgs.org/namespace.html#export-s3) of the R packages book? – Nick May 05 '20 at 03:31
  • burger, many packages have unexported S3 functions, but I've found when mimicking that in my own packages, often the S3 method is not incorporate correctly. This might be due to several things (not just or specifically `roxygen2`), but exporting them all *is* simpler and preempts all of those problems I had. I don't think it's clobbering the namespace significantly (well, that depends on how many you have). I suggest you use the simplest path and export them all. – r2evans May 05 '20 at 13:56
  • That all makes sense. I just don't understand why the behavior changed from R 3.6 to 4.0. – burger May 05 '20 at 14:22

0 Answers0