Error in as.environment(pos) / Error during wrapup: no item called "package:[package]" on the search list

Hi folks,

This is similar to this but with a followup question:

I'm preparing my package for submission to CRAN. In one script, it gives the titular error:

Error in as.environment(pos): no item called "package:shapefiles" on the search list


Error during wrapup: no item called "package:shapefiles" on the search list

If, like the similar thread linked above, I add


Then I no longer get that error, but instead get the error or warning:

namespace(shapefiles) was already taken

Sometimes, I believe if the function/script is run more than once. What's so weird about this to me is that

#' @import shapefiles

is in that scripts markdown block,

Which means


is in NAMESPACE, and

    shapefiles (>= 0.7),

is in DESCRIPTION. I have numerous other package dependencies which are imported the same way (correctly, I believe), and none of them produce this error. I don't see why this is behaving differently therefore, and would like to avoid having either issue before submitting to CRAN. The code that calls this package, in my script, is


Script is here, for reference.

Thanks in advance for any ideas!

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.