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.
Motivation
gsDesign2::gs_design_npe()currently returns an object whose classes are only:The column schema is distinctive and useful (
analysis,bound,z,probability,probability0,theta,info_frac,info,info0, andinfo1), but downstream packages cannot identify the object reliably withoutmatching its column names. In contrast, the other
gsDesign2designconstructors return objects with a package-specific class.
This arose while adding direct support for
gs_design_npe()results togsDesignBroom::compare_designs():https://github.com/keaven/gsDesignBroom/issues/2
Suggested enhancement
Could
gs_design_npe()add a dedicated S3 class while retaining its existingtibble classes and behavior? For example:
This would allow downstream packages to register methods or dispatch to a
schema adapter using
inherits(x, "gs_design_npe"), rather than relying onheuristic column-signature detection.
Possible acceptance criteria
inherits(gs_design_npe(...), "gs_design_npe")isTRUE.tbl_df,tbl, anddata.frame.this result type.
This is not blocking the downstream implementation, but it would make the
integration more robust and easier to maintain.