Skip to content
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

Bug Report: tbl_survfit() fails when times is an integer #1867

Closed
DanChaltiel opened this issue Jul 24, 2024 · 3 comments · Fixed by #1868
Closed

Bug Report: tbl_survfit() fails when times is an integer #1867

DanChaltiel opened this issue Jul 24, 2024 · 3 comments · Fixed by #1868
Assignees

Comments

@DanChaltiel
Copy link

Hi,

It seems that tbl_survfit() fails when times is an integer.
This happens mostly when using the : operator.

Here is a reprex:

library(survival)
library(gtsummary)

tbl_survfit(
  survfit(Surv(ttdeath, death) ~ trt, trial),
  times = 1:2
)
#> Error in `tbl_survfit.list()`:
#> ! The `times` argument must be class <numeric> or empty, not an integer
#>   vector.

Created on 2024-07-24 with reprex v2.1.0

@ddsjoberg
Copy link
Owner

Ah, thank you so much for letting me know about this regression 🤦🏼🤦🏼🤦🏼 😭

NOTE to self: Check for any numeric checks that should also allow integers in the updated error messaging.

inherits(1L, "numeric")
#> [1] FALSE
is.numeric(1L)
#> [1] TRUE

Created on 2024-07-24 with reprex v2.1.0

@ddsjoberg
Copy link
Owner

Update check_class(times, "numeric") to check_class(times, c("numeric", "integer")), then we should be good to go. Also review the rest of the pkg for check_class(x, "numeric") to see if we need to update those as well.

@ddsjoberg
Copy link
Owner

Thanks again for the report @DanChaltiel ! Issue is resolved in dev

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 a pull request may close this issue.

3 participants