Search code examples
rr-package

How to register methods without referring to the S3 ones


I had written some R functions that I wanted to convert to an R package. One of them is called for example print.pretty.values and another print.empty.line. Package builds and installs alright, but when I run the check function I get this warning:

Found the following apparent S3 methods exported but not registered

I have read the relevant documentation and I don't want to have a print function of my class someClass. I just need to export nicely (and without warning) a function that is called print.something or plot.something.else without it being understood as an S3 method and without me having to change the name. Is there a way to define this (in the function documentation or the NAMESPACE file?)


Solution

  • I changed all the names of the functions to have the underscore separator (_) instead of the dot (.), following the tidyverse guidelines: https://style.tidyverse.org/syntax.html

    Note that the only case that they 'allow' dots in functions are when you write function.class or class.name and in my case it wasn't like that (print.pretty.values wasn't an S3 function - I just wanted to use the dot as a separator for words in general and thus I got warnings).