I am creating an R package in RStudio. Say I have two functions fnbig()
and fnsmall()
in my package named foo
. fnbig()
is a function that must be accessible to the user using the package. fnsmall()
is an internal function that must not accessible to the user but should be accessible inside of fnbig()
.
# package code
fnsmall <- function()
{
bla bla..
}
#' @export
fnbig <- function()
{
bla bla..
x <- fnsmall()
bla..
}
I have tried exporting fnsmall()
. All works but it litters the NAMESPACE. I tried not exporting fnsmall()
, but then it doesn't work inside fnbig()
when using x <- fnsmall()
or x <- foo::fnsmall()
. Then I tried to use x <- foo:::fnsmall()
, and it works. But I read that using :::
is not recommended.
What is the best way to go about doing this? How do I call an internal function from an exported function?