Hi there,
I've just built my first R package, so I'm very new to understanding package development. I haven't been able to find the answer to this question on this forum or others, but please bear with me if the answer is really obvious and I'm just not googling correctly.
I created a small package and put it up on Github. I documented in using devtools and roxygen2. Then I installed the package using devtools::install_github() and loaded it with library(); then I attempted to use functions from the package. Most of the functions worked, but for just one of the functions, I'm getting the error "could not find function".
I know that this "could not find function" error typically happens when the package in question isn't properly installed and loaded. I double checked that the package was both installed and loaded (and even opened up a new R session and re-installed and re-loaded it to make sure). devtools::document() ran with no errors or warnings, and a .Rd file was successfully created for the function in question. The line export(functionname) is present in the NAMESPACE file.
The package is on Github here. The function that I can't get to work is preprocessData(). The other functions seem to work fine.
My guess:
preprocessData() is different from the other functions in the package in that it calls other package functions: it's a wrapper for fixNames() and removeGeo(). I wonder if the error is happening because it's invalid to have functions call each other within a package? This SO post seems to have a similar error, but based on the responses there I think I should be in the clear: the functions are in the same namespace, the documentation is updated, etc. This post also seems to say that it's fine to have functions in the same package call each other.
So I'm not sure what I'm missing. Can anyone help figure out why I'm having this problem? I'd like to write some other wrapper functions, but I'm hesitant to start if it's going to turn out that this isn't a valid thing to do.
Thank you!