-
Notifications
You must be signed in to change notification settings - Fork 21
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
Pull Request by Zilin Huang regarding Issue #216 #226
base: main
Are you sure you want to change the base?
Changes from all commits
53d9d9a
13246ff
49eb779
f698742
a118761
51354b6
48dc898
afe867c
79f51be
7d501d9
93d688c
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 |
---|---|---|
|
@@ -34,8 +34,23 @@ | |
#' # specify additional scales | ||
#' ggsurvfit + | ||
#' scale_ggsurvfit(x_scales = list(breaks = seq(0, 8, by = 2))) | ||
#' | ||
#' @details | ||
#' Specical case: in the risk table, large numbers (with more than 4 digits) may not | ||
#' be shown completely, with some digits truncated outside the plot region. | ||
#' To remedy this, consider the following example code for a simulated large-size survival dataset: | ||
#' Here, adjust the expand size in `scale_ggsurvfit(x_scales = list(expand = c(0.05, 0)))` (for example) | ||
#' can modify the position of numbers in the risk table | ||
#' and make them all fit in the plot region. The scale of the `expand` argument differs by cases. | ||
#' | ||
#' df_colon_large <- df_colon[sample(1:nrow(df_colon), size = 15*nrow(df_colon), replace = TRUE), ] | ||
#' ggsurvfit <- | ||
#' survfit2(Surv(time, status) ~ surg, data = df_colon_large) %>% | ||
#' ggsurvfit() + add_risktable() + | ||
#' scale_ggsurvfit() | ||
Comment on lines
+39
to
+50
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 looks great, thank you! upon looking at it, perhaps we don't need the full example, and just keep this part: |
||
#' @inherit ggsurvfit seealso | ||
scale_ggsurvfit <- function(x_scales = list(), y_scales = list()){ | ||
scale_ggsurvfit <- | ||
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. Can you put this back on one line? 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. I have already done this. It'll be ready to merge. |
||
function(x_scales = list(), y_scales = list()){ | ||
scale_ggsurvfit_empty_list <- list() | ||
structure(scale_ggsurvfit_empty_list, x_scales = x_scales, y_scales = y_scales, class = "scale_ggsurvfit") | ||
} | ||
|
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.
This is great, thank you for adding. Let's keep the message simple with
"Argument {.arg x} does not support {.cls survfit.coxphms} object."
.Can you also add a unit test to test appropriate error messaging with
expect_error()
?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.
Thanks @ddsjoberg, I'll work with the unit test later (on Issue #222 PR)