Bug 17167 - survival::is.ratetable can be inconsistent with verbose = TRUE
Summary: survival::is.ratetable can be inconsistent with verbose = TRUE
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: R 3.3.*
Hardware: ix86 (32-bit) Windows 32-bit
: P5 minor
Assignee: R-core
Depends on:
Reported: 2016-10-21 20:51 UTC by Nathan Werth
Modified: 2016-10-25 19:27 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Werth 2016-10-21 20:51:20 UTC
When using is.ratetable on an object, it's possible to have is.ratetable(x) return TRUE but is.ratetable(x, verbose = TRUE) return a message stating why x is not a ratetable.

Example using a ratetable from the relsurv package (version 2.0.9):

# [1] TRUE
is.ratetable(slopop, verbose = TRUE)
# [1] "wrong length for cutpoints 3"

After looking through the code for is.ratetable, I think the problem comes up when a ratetable doesn't have the "type" attribute. In that case, is.ratetable determines what the type should have been by using the "factor" attribute, but gets it wrong:

type <- 1 * (fac == 1) + 2 * (fac == 0) + 4 * (fac > 0)

This maps a factor value of 1 to a type value of 5, which is outside the allowed range.

Session info:

R version 3.3.0 (2016-05-03)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] relsurv_2.0-9   date_1.2-34     survival_2.39-5

loaded via a namespace (and not attached):
[1] Matrix_1.2-6    rsconnect_0.4.3 tools_3.3.0     grid_3.3.0      lattice_0.20-33
Comment 1 Terry Therneau 2016-10-25 19:27:14 UTC
Fixed in survival 2-39.6, T. Therneau