-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor methods by passing table metadata as attributes #497
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -132,6 +132,9 @@ fixed_design_ahr <- function( | |||||||||||||||||
input = input, enroll_rate = d$enroll_rate, | ||||||||||||||||||
fail_rate = d$fail_rate, analysis = ans, design = "ahr" | ||||||||||||||||||
) | ||||||||||||||||||
attr(y, "design_display") <- "Average hazard ratio" | ||||||||||||||||||
attr(y, "title") <- "Fixed Design under AHR Method" | ||||||||||||||||||
attr(y, "footnote") <- "Power computed with average hazard ratio method." | ||||||||||||||||||
Comment on lines
+135
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be done in a single
Suggested change
Or even include everything in the y <- structure(
list(
input = input, enroll_rate = d$enroll_rate,
fail_rate = d$fail_rate, analysis = ans, design = "ahr"
),
class = "fixed_design",
design_display = "Average hazard ratio",
title = "Fixed Design under AHR Method",
footnote = "Power computed with average hazard ratio method."
) Feel free to pick a form that you are comfortable with. |
||||||||||||||||||
class(y) <- c("fixed_design", class(y)) | ||||||||||||||||||
return(y) | ||||||||||||||||||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that we provide a helper function like this in utils.R: https://github.com/yihui/knitr/blob/35308a212e15649b8d191d652714abd9108f7c87/R/utils.R#L51 The only thing I can't tolerate about R is the default partial matching.