Skip to content
Prev 41284 / 63424 Next

"could not find function" after import

On 11-09-19 4:48 PM, Stephanie M. Gogarten wrote:
If you said that your package Depends on sandwich, you'd probably pass 
checks, but this is arguably a bug in the sandwich package.

The problem is that since you only import sandwich, it never gets 
attached.  So it never attaches its dependency zoo.   It should import 
zoo (or import the functions in zoo that it uses) to work properly the 
way you are calling it.

You can see the same error as follows:

1.  Install sandwich, but don't attach it or zoo.

2.  Run

example(glm)

to create the "glm" object glm.D93.

Try to call

sandwich::estfun(glm.D93)

You'll get the same error as before because is.zoo() will not be loaded.

It's also arguably a design flaw in R.  For testing sandwich, zoo would 
generally end up being attached, because the testing of sandwich would 
attach it.  However, examples like the one above are never tested.

Duncan Murdoch