Skip to content

Unified wrapper functions for bayesplot families #433

@florence-bockting

Description

@florence-bockting

Summary

Currently, each plot family in bayesplot exposes several closely related functions that share common inputs but differ in specific behaviors. For example, the error family within the PPC module includes:

  • ppc_error_hist()
  • ppc_error_hist_grouped()
  • ppc_error_scatter()
  • ppc_error_binned()
  • ...

Exposing all these individual functions in the documentation can make it difficult for users to navigate the package. To improve usability, I would propose providing a wrapper function for each family that consolidates these related functions into a single "general concept".

Proposed Change

Introduce a high-level wrapper for each family that dispatches to the underlying functions via a type argument. Below is an example of the intended structure (subject to further refinement):

ppc_error <- function(
    y,
    yrep,
    type = c("hist", "scatter", "scatter_avg", "scatter_avg_vs_x", "binned"),
    group = NULL,
    x = NULL,
    grouped = FALSE,
    ...
    )

We could implement a similar pattern for other families. This approach would result in a more organized API and more compact documentation pages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions