I'm working on an R package that uses the spTransform
function in the sp
package. The rub is that this function need rgdal
loaded to work, or I get an error message:
Error in eval(expr, envir, enclos) : load package rgdal for spTransform methods
My Imports
statement in the DESCRIPTION
file includes the following:
Imports: sp,
rgdal
But I'm still getting the error. However, if I explcitly load rgdal (using library(rgdal)
) before using the package, everything works fine. I'm guessing that when my package is loaded rgdal is not attached because none of my code uses it explcitly via ::
etc.
So I think my question is: How can I make my package attach a package that I am not explicitly using?