1

I am taking over an R project and I am attempting to keep the naming as consistent as possible from the person who worked on the project before me.

I have created several functions for a package being developed. Above each function, I have the #' @export which is used to create the NAMESPACE file in roxygen2:

#' @export
a.function = function(x){
# do stuff
}

#' @export
another.function = function(x){
# do stuff
}

When I create the documentation using roxygen2, the NAMESPACE file created will categorize some functions as methods. Periods (.) will also be converted into commas (,). For example, the namespace for the functions above might appear as

S3method(a.function)
export(another.function)

Furthermore, the person who worked on the project before me occasionally used 3 periods when naming a function:

yet.another.function = function(x){
# do stuff
}

But Roxygen2 converts the first period into a comma in all functions with 3 periods in the NAMESPACE file. By this I mean that the function above would appear as

export(yet,another.function)

in the NAMESPACE file.

My questions are as follows:

  • How does Roxygen distinguish some functions as S3method and some as functions and use export in NAMESPACE?

  • Is it possible to force or coerce Roxygen to recognize all functions as functions and to use export?

  • Is it possible to stop Roxygen from converting periods in the function name to commas in the NAMESPACE file?

Unfortunately I was not able to directly find the answer to these in either the Roxygen documentation or other posts on stack Overflow.

NM_
  • 1,887
  • 3
  • 12
  • 27
  • Look at https://github.com/r-lib/roxygen2/issues/673 and https://stackoverflow.com/questions/24594507/exporting-non-s3-methods-with-dots-in-the-name-using-roxygen2-v4 – duckmayr May 01 '20 at 12:52

0 Answers0