Skip to content

Add a dedicated S3 class to gs_design_npe() output #657

Description

@keaven

Motivation

gsDesign2::gs_design_npe() currently returns an object whose classes are only:

c("tbl_df", "tbl", "data.frame")

The column schema is distinctive and useful (analysis, bound, z,
probability, probability0, theta, info_frac, info, info0, and
info1), but downstream packages cannot identify the object reliably without
matching its column names. In contrast, the other gsDesign2 design
constructors return objects with a package-specific class.

This arose while adding direct support for gs_design_npe() results to
gsDesignBroom::compare_designs():
https://github.com/keaven/gsDesignBroom/issues/2

Suggested enhancement

Could gs_design_npe() add a dedicated S3 class while retaining its existing
tibble classes and behavior? For example:

class(result) <- c("gs_design_npe", class(result))

This would allow downstream packages to register methods or dispatch to a
schema adapter using inherits(x, "gs_design_npe"), rather than relying on
heuristic column-signature detection.

Possible acceptance criteria

  • inherits(gs_design_npe(...), "gs_design_npe") is TRUE.
  • The result continues to inherit from tbl_df, tbl, and data.frame.
  • Existing printing, subsetting, and column names remain unchanged.
  • The class is documented as a stable way for downstream packages to identify
    this result type.

This is not blocking the downstream implementation, but it would make the
integration more robust and easier to maintain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions