Description
I am currently building a package that makes use of cmdstanr (thank you for your amazing work btw). One of the main user facing objects that we produce composes the CmdStanMCMC
object with a bunch of other stuff that we need. We want to be able to expose the underlying CmdStanMCMC
to users for them to use in their downstream code and this is easy enough to do via something like:
as.CmdStanMCMC.MyModelObject <- function(object) {
object@stanSamples
}
I was conscious though that it might seem weird for me to be defining generics like this considering that the CmdStanMCMC
object doesn't originate from my package. I could also imagine other packages maybe having a similar need for similar generics as well.
In short my proposal would be for you to export as.CmdStanMCMC
generic (as well as potentially similar generics for your other objects) for downstream package developers to use.
Needless to say this is a pretty niche requirement so no worries if you don't want to create/export these generics.