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 asS3method
and some as functions and useexport
inNAMESPACE
?Is it possible to force or coerce
Roxygen
to recognize all functions as functions and to useexport
?Is it possible to stop
Roxygen
from converting periods in the function name to commas in theNAMESPACE
file?
Unfortunately I was not able to directly find the answer to these in either the Roxygen
documentation or other posts on stack Overflow.