Skip to content

Conversation

@shajoezhu
Copy link
Contributor

What changes are proposed in this pull request?

  • Style this entry in a way that can be copied directly into NEWS.md. (#, @)

Provide more detail here as needed.

Reference GitHub issue associated with pull request. e.g., 'closes #'


Pre-review Checklist (if item does not apply, mark is as complete)

  • All GitHub Action workflows pass with a ✅
  • PR branch has pulled the most recent updates from master branch: usethis::pr_merge_main()
  • If a bug was fixed, a unit test was added.
  • Code coverage is suitable for any new functions/features (generally, 100% coverage for new code): devtools::test_coverage()
  • Request a reviewer

Reviewer Checklist (if item does not apply, mark is as complete)

  • If a bug was fixed, a unit test was added.
  • Run pkgdown::build_site(). Check the R console for errors, and review the rendered website.
  • Code coverage is suitable for any new functions/features: devtools::test_coverage()

When the branch is ready to be merged:

  • Update NEWS.md with the changes from this pull request under the heading "# cards (development version)". If there is an issue associated with the pull request, reference it in parentheses at the end update (see NEWS.md for examples).
  • All GitHub Action workflows pass with a ✅
  • Approve Pull Request
  • Merge the PR. Please use "Squash and merge" or "Rebase and merge".

@shajoezhu
Copy link
Contributor Author

shajoezhu commented Nov 28, 2025

try and use exisitng structure and surv functions, refactoring will be addressed in #142

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

Unit Tests Summary

  1 files   71 suites   1m 28s ⏱️
 71 tests  71 ✅ 0 💤 0 ❌
179 runs  179 ✅ 0 💤 0 ❌

Results for commit 67f9bcf.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
gkm 👶 $+0.05$ $+3$ $0$ $0$ $0$
Additional test case details
Test Suite $Status$ Time on main $±Time$ Test Case
gkm 👶 $+0.05$ test_gkm_works

Results for commit 45fde37

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

badge

Code Coverage Summary

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ----------------------------------------------------------------------------------------------------
R/add_blank_rows.R                        63       0  100.00%
R/add_difference_row.R                   101       0  100.00%
R/add_hierarchical_count_row.R            33       0  100.00%
R/crane-package.R                          2       2  0.00%    27-28
R/deprecated.R                             6       6  0.00%    15-21
R/gg_km_utils.R                          119      17  85.71%   46, 103-120, 136, 199
R/gg_km.R                                220      40  81.82%   50-53, 70, 97, 186-188, 192-199, 222-224, 231-234, 238, 249-253, 266, 268-270, 284, 287-289, 405-409
R/label_roche.R                           72       0  100.00%
R/modify_header_rm_md.R                   18       2  88.89%   35-36
R/modify_zero_recode.R                    13       0  100.00%
R/tbl_baseline_chg.R                     186       0  100.00%
R/tbl_hierarchical_rate_and_count.R      148       0  100.00%
R/tbl_hierarchical_rate_by_grade.R       271       3  98.89%   162-164
R/tbl_listing.R                           35       0  100.00%
R/tbl_null_report.R                        9       0  100.00%
R/tbl_roche_summary.R                     64       0  100.00%
R/tbl_shift.R                            116       0  100.00%
R/tbl_survfit_quantiles.R                132       1  99.24%   295
R/tbl_survfit_times.R                     92       0  100.00%
R/theme_gtsummary_roche.R                 74       0  100.00%
R/utils.R                                 36       0  100.00%
TOTAL                                   1810      71  96.08%

Diff against main

Filename           Stmts    Miss  Cover
---------------  -------  ------  -------
R/gg_km_utils.R     +119     +17  +85.71%
R/gg_km.R           +220     +40  +81.82%
TOTAL               +339     +57  -2.97%

Results for commit: 67f9bcf

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@shajoezhu
Copy link
Contributor Author

need examples and export
h_km_fit, h_tbl_coxph_pairwise,

@shajoezhu shajoezhu mentioned this pull request Nov 30, 2025
3 tasks
@shajoezhu
Copy link
Contributor Author

my styler is failing, @edelarua , i was wondering how you guys check style here https://github.com/insightsengineering/crane/actions/runs/19792793759/job/56708402248?pr=141

@shajoezhu
Copy link
Contributor Author

  • checking Rd cross-references ... WARNING
    Missing link(s) in Rd file 'annot_cox_ph.Rd':
    ‘control_coxph_annot’

Missing link(s) in Rd file 'annot_surv_med.Rd':
‘control_surv_med_annot’

Missing link(s) in Rd file 'h_tbl_coxph_pairwise.Rd':
‘control_coxph’

Missing link(s) in Rd file 's_coxph_pairwise.Rd':
‘control_coxph’

See section 'Cross-references' in the 'Writing R Extensions' manual.

  • checking for missing documentation entries ... WARNING
    Undocumented code objects:
    ‘obj_label’
    Undocumented S4 methods:
    generic 'obj_label' and siglist 'ANY'
    generic 'obj_label<-' and siglist 'ANY'
    All user-level objects in a package (including S4 classes and methods)
    should have documentation entries.
    See chapter ‘Writing R documentation files’ in the ‘Writing R
    Extensions’ manual.
  • checking for code/documentation mismatches ... OK
  • checking Rd \usage sections ... WARNING
    Undocumented arguments in Rd file 'obj_label-set.Rd'
    ‘obj’

@shajoezhu shajoezhu requested a review from Melkiades December 3, 2025 04:50
DESCRIPTION Outdated
Comment on lines 30 to 31
cowplot (>= 1.2.0),
checkmate (>= 2.3.2),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we do not need checkmate AND assertthat. Also I would not add them as we do not need them in nest 2.0 (bad error messaging)

#' annot_cox_ph(plt_kmg01, coxph_tbl)
#'
annot_cox_ph <- function(gg_plt, coxph_tbl, control_annot_coxph = control_coxph_annot(), font_size = 10) {
# ... (function body remains the same)
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can remove this line

R/gkm.R Outdated
Comment on lines 316 to 336
g_km <- function(
surv_plot_data,
col = NULL,
lty = NULL,
lwd = 0.5,
censor_show = TRUE,
pch = 3,
size = 2,
max_time = NULL,
xticks = NULL,
xlab = "Days",
yval = c("Survival", "Failure"),
ylab = paste(yval, "Probability"),
ylim = NULL,
title = NULL,
footnotes = NULL,
font_size = 10,
ci_ribbon = FALSE,
legend_pos = NULL,
ggtheme = NULL
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

too many parameters imo

R/gkm.R Outdated
Comment on lines 286 to 304
#' @param surv_plot_data A data frame containing the pre-processed survival data, ready for plotting.
#' This data should be equivalent to the output of \code{h_data_plot}.
#' @param col A character vector of colors for the survival curves. Length should match number of arms.
#' @param lty A vector of line types for the survival curves, or \code{NULL} for default.
#' @param lwd Numeric value specifying line width for the survival curves.
#' @param censor_show Logical, whether to display censoring marks on the plot.
#' @param pch Plotting character for censoring marks.
#' @param size Size of the censoring marks.
#' @param max_time Numeric, the maximum time point to display on the x-axis.
#' @param xticks Numeric vector of x-axis tick positions, or a single number for the interval, or \code{NULL} for auto.
#' @param xlab Character string for the x-axis label.
#' @param yval Character string, either \code{"Survival"} or \code{"Failure"} to plot Survival or Failure probability.
#' @param ylab Character string for the y-axis label.
#' @param ylim Numeric vector of length 2 for y-axis limits.
#' @param title Character string for the plot title.
#' @param footnotes Character string for plot footnotes/caption.
#' @param font_size Numeric, base font size for the plot theme.
#' @param ci_ribbon Logical, whether to display confidence intervals as a ribbon (area).
#' @param legend_pos Numeric vector of length 2 for legend position (x, y) relative to the plot area (0 to 1), or \code{NULL} for auto-placement.
Copy link
Contributor

Choose a reason for hiding this comment

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

parameter description does not reflect the rest of the package standard

R/gkm.R Outdated
Comment on lines 45 to 46
xend = tot_width - 0.1 * tail(colwidths, 1), y = nrow(df) -
0.5, yend = nrow(df) - 0.5
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to style this a bit

R/gkm.R Outdated
Comment on lines 194 to 195
current_row <- data.frame(
hr = sprintf("%.2f", coxph_ans$conf.int[1, 1]),
Copy link
Contributor

Choose a reason for hiding this comment

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

we should use glue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

go for it

@shajoezhu shajoezhu changed the title init commit kmg plot Dec 4, 2025
@Melkiades Melkiades marked this pull request as draft December 4, 2025 15:50
@shajoezhu
Copy link
Contributor Author

hi davide, can you fix the test please https://github.com/insightsengineering/crane/actions/runs/19936180249/job/57161536238 thanks

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.

3 participants