bayesplot
bayesplot copied to clipboard
Make most plotting functions methods
I think it would help usability to make the various functions methods. I love that the functions are frontend agnostic and take arrays or data frames, but it would make it much more usable if the they were methods, so it would work directly with stanfit
and stanreg
objects.
I haven't looked too much at the code, but it looks like the internal function prepare_mcmc_array
is doing most of what a method dispatcher would do. Maybe just exposing that function and making it a method would be sufficient.
Thanks for the suggestions. More comments/questions below:
On Tue, May 23, 2017 at 2:44 PM, Jeffrey Arnold [email protected] wrote:
I haven't looked too much at the code, but it looks like the internal function prepare_mcmc_array is doing most of what a method dispatcher would do.
Yeah pretty much. It wouldn't be hard to convert it to S3 generic and methods.
Maybe just exposing that function and making it a method would be sufficient.
Do you mean that bayesplot would provide prepare_mcmc_array methods for stanfit and stanreg objects?
Yes. If prepare_mcmc_array
was made a generic function with methods for stanfit
and stanreg
objects, then it might be possible to avoid writing separate methods for each (or many) of the plotting functions.