Skip to content

Conversation

@jdblischak
Copy link
Collaborator

This is a follow-up to my big refactor of the S3 classes in #584. I missed the use of class(x) at the end of to_integer() to assign the attribute uninteger_is_from. This caused the wrong value of uninteger_is_from to be assigned because the method is no longer embedded in the class hierarchy.

gsDesign2/R/to_integer.R

Lines 579 to 592 in 5103d9c

# Add attributes to x_new to identify whether it is a gs_design_ahr orbject or gs_power_ahr object
if ("analysis_time" %in% names(x$input) && "info_frac" %in% names(x$input) && "ahr" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_design_ahr"
} else if ("analysis_time" %in% names(x$input) && "event" %in% names(x$input) && "ahr" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_power_ahr"
} else if ("analysis_time" %in% names(x$input) && "info_frac" %in% names(x$input) && "wlr" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_design_wlr"
} else if ("analysis_time" %in% names(x$input) && "event" %in% names(x$input) && "wlr" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_power_wlr"
} else if (!("n" %in% names(x$input)) && "rd" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_design_rd"
} else if ("n" %in% names(x$input) && "rd" %in% class(x)) {
attr(x_new, 'uninteger_is_from') <- "gs_power_rd"
}

While writing a test for this, I discovered that to_integer() is unable to process the object returned by gs_power_rd() because it doesn't have the element input with the values of its input arguments. I went ahead and fixed that too.

@jdblischak jdblischak self-assigned this Oct 29, 2025
Copy link
Collaborator

@LittleBeannie LittleBeannie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @jdblischak! I got it merged.

@LittleBeannie LittleBeannie merged commit 1b56b9f into Merck:main Nov 7, 2025
7 checks passed
@jdblischak jdblischak deleted the fix-uninteger_is_from branch November 10, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants