0
votes

NAMESPACES file generated automatically by Roxygen2 cannot be edited by hand. However, notes tells me to add code to NAMESPACE file.

When making a new R package using roxygen2, the NAMESPACES file is generated automatically and cannot be edited by hand. However, when I run check, I got the notes telling me to add code to NAMESPACE file

checking R code for possible problems ... NOTE
myFunction1: no visible global function definition for 'combn'
myFunction2: no visible global function definition for 'chisq.test'
myFunction3: no visible global function definition for 'rbinom'
Undefined global functions or variables:
chisq.test combn rbinom
Consider adding
importFrom("stats", "chisq.test", "rbinom")
importFrom("utils", "combn")
to your NAMESPACE file.

Should I follow the notes to edit NAMESPACES file by hand or just follow the roxygen2? If I edit, how should I get rid of Roxygen2.

1

1 Answers

1
votes

The note to edit your NAMESPACE file is because that's what you would do if you didn't use roxygen. Since you are a roxygen user, you instead add the @importFrom directive to an R source file:

#' @importFrom stats chisq.test rbinom
#' @importFrom utils combn
NULL