Unable to access all functions listed in help file despite having newest version of package

I'm not sure were to post this, I've already contacted the author but I was wondering if some of you might try to troubleshoot this with me. I've downloaded the bife package but I can only access 5 of its functions, even though my R is relatively up to date (4.0.2) and the help file tells me I have the latest package version. Yet, the help file lists additional functions I cannot use (especially interested in predict.bife()). What might be causing this? Can anyone else download and check if they get the same error? I try to reinstall of course, but I'm curious if this is my PC or if there's a bug

hello @isadora,

the help information for the predict.bife says
predict.bife is a generic function which obtains predictions from an object returned by bife
That means that when you use predict(mybife_object) this call is transferred to predict.bife(mybife_object) in the environment of the bife package.
So there is no need to export the function outside the bife package.

To make it visible outside the bife package use bife:::predict.bife (notice the three colons)

I don't understand what you mean by "So there is no need to export the function outside the bife package." I cannot access the function even when I load the package, the image was taken after the package had been loaded too. (Thanks for the triple colon information). Also, predict.bife was an example, as you can see from the right-hand side of the screenshot, the majority of the functions listed are not available. So if I run predict.bife(LogitFE, type = "response") without bife::: preceding it, I get Error in predict.bife(LogitFE, type = "response") : could not find function "predict.bife" but same goes for bife:::fitted.bife(LogitFE) vs fitted.bife(LogitFE), etc.

Hello @isadora,

I had the impression (wrongly I see now) that you wanted to view the source of the code.
When you want to execute the code of a generic function you don't mention the class (in your case bife).
You just use

mod <- bife( .........)
predict(mod) # calls predict.bife

See here section 4.3 for an explanation.
Or see Advanced R section 13.4 by Hadley Wickham but this text is indeed rather advanced.

And the same goes for bife:::fitted.bife :
only specify fitted(LogitFE) with LogitFE a bife object.

I still don't think my question has been understood. The class observation you bring up is not my question. My question is why the majority of the functions listed in the help file are INACCESSIBLE even after library-loading the package unless I use the three :::.

Hello @isadora,

what do you mean by accessible:

  • read the source of e.g. predict.bife :
    type bife:::predict.bife
  • use the function e.g. predict.bife:
    type predict(object-of-class-bife)

The nice thing of generic functions is that for those 'general' functions you don't have to specify a specific function: only specify the generic name and the R environment knows the exact function to use.

My suggestion: make a small example in which you create a bifemodel and then try one or more of the functions that you think inaccessable in the way described above. If they are still not working then copy all the code (from creation of the model to the failing function calls) in an answer to this message.

This topic was automatically closed 21 days after the last reply. 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.