tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
90 stars 31 forks source link

Saving report() as an object rather than displaying on the console #409

Open andrewbcooper opened 1 month ago

andrewbcooper commented 1 month ago

I've poked around quite a bit but haven't found anything about this. The report() function is fantastic, but I can only get it to display on the console. I'm not able to save it as an object and then, say, reformat it or re-arrange the elements in a Markdown document. I've been able to partially accomplish this using:

myoutput <- utils::capture.output(report(mymodel))

But that's pretty clunky (and I don't trust that the location of the character strings will be consistent across different model formulations) Is there an option within the report() function to save it as an object?

Thanks!

mitchelloharawild commented 1 month ago

report() is intended as a console output allowing you to see an overview of the model. Consistency of character strings is dependent on the console width.

All aspects of the models shown in report() can be obtained using tidy() and glance() for coefficients and statistics respectively. Using these functions is the recommended approach to programmatically interact with models.