{"action":"opened","issue":{"url":"https://api.github.com/repos/kassambara/survminer/issues/86","repository_url":"https://api.github.com/repos/kassambara/survminer","labels_url":"https://api.github.com/repos/kassambara/survminer/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/kassambara/survminer/issues/86/comments","events_url":"https://api.github.com/repos/kassambara/survminer/issues/86/events","html_url":"https://github.com/kassambara/survminer/issues/86","id":192909243,"number":86,"title":"error in ggsurvplot due to specific form of fit","user":{"login":"MarcinKosinski","id":6773454,"avatar_url":"https://avatars.githubusercontent.com/u/6773454?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcinKosinski","html_url":"https://github.com/MarcinKosinski","followers_url":"https://api.github.com/users/MarcinKosinski/followers","following_url":"https://api.github.com/users/MarcinKosinski/following{/other_user}","gists_url":"https://api.github.com/users/MarcinKosinski/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcinKosinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcinKosinski/subscriptions","organizations_url":"https://api.github.com/users/MarcinKosinski/orgs","repos_url":"https://api.github.com/users/MarcinKosinski/repos","events_url":"https://api.github.com/users/MarcinKosinski/events{/privacy}","received_events_url":"https://api.github.com/users/MarcinKosinski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-01T17:21:02Z","updated_at":"2016-12-01T17:21:02Z","closed_at":null,"body":"Hi again!\r\n\r\nI am using ggsurvplot in RTCGA package - survminer is really helpful. Today I have noticed that RTCGA broke http://bioconductor.org/checkResults/release/bioc-LATEST/RTCGA/ due to the ERROR in `kmTCGA` function which is the only function that uses `ggsurvplot`.\r\n\r\nI have found that for my data in the `kmTCGA` example the fit is so specific that it does not have calculated median of survival times (probably due to the small size of one group). This example was working for RTCGA ver 1.2.0 -> the last example from this staticdoc http://rtcga.github.io/RTCGA/staticdocs/kmTCGA.html but now it brokes in the newest version of survminer (but this hasn't changed for 2 months on CRAN, sic!). I think this must be due to the newest release of survival https://cran.r-project.org/web/packages/survival/index.html \r\n\r\nDo you think you can workaround this in `survminer` or can your provide any solution for that? RTCGA doesn't work, survminer neither : /\r\n\r\n``` r\r\nlibrary(RTCGA.clinical)\r\nlibrary(dplyr)\r\n# first extract survival info, then munge data                  \r\nsurvivalTCGA(BRCA.clinical, \r\n             extract.cols = c(\"patient.drugs.drug.therapy_types.therapy_type\"))  %>%\r\nfilter(patient.drugs.drug.therapy_types.therapy_type %in%\r\n           c(\"chemotherapy\", \"hormone therapy\")) %>%\r\nrename(therapy = patient.drugs.drug.therapy_types.therapy_type) -> BRCA.survInfo.chemo\r\n\r\nhead(BRCA.survInfo.chemo)\r\n```\r\n\r\n      times bcr_patient_barcode patient.vital_status         therapy\r\n    1  3767        TCGA-3C-AAAU                    0    chemotherapy\r\n    2  1217        TCGA-3C-AALK                    0    chemotherapy\r\n    3   158        TCGA-4H-AAAK                    0    chemotherapy\r\n    4  1477        TCGA-5L-AAT0                    0 hormone therapy\r\n    5  1471        TCGA-5L-AAT1                    0 hormone therapy\r\n    6  1463        TCGA-A1-A0SF                    0 hormone therapy\r\n\r\n``` r\r\ntable(BRCA.survInfo.chemo[, c(3,4)])\r\n```\r\n\r\n                        therapy\r\n    patient.vital_status chemotherapy hormone therapy\r\n                       0          469             266\r\n                       1           18               7\r\n\r\n``` r\r\n# fit survival model\r\nlibrary(survival)\r\nformu <- survival::Surv(times, patient.vital_status) ~ therapy\r\nfit <- do.call(survival::survfit, list(formula = formu, data = BRCA.survInfo.chemo))\r\n```\r\n\r\n``` r\r\n# create survival plots with survminer\r\nlibrary(survminer)\r\nggsurvplot(fit)\r\n\r\nError in `[[<-.data.frame`(`*tmp*`, variable, value = c(1L, NA, 1L, NA,  : \r\n  replacement has 1264 rows, data has 632\r\n```\r\n\r\nmaybe this is the reason of `NA`s in the median and confidence intervals in the last table of the print of the `fit` object?\r\n\r\n``` r\r\nfit\r\n```\r\n\r\n    Call: survfit(formula = survival::Surv(times, patient.vital_status) ~ \r\n        therapy, data = structure(list(times = c(3767, 1217, 158, \r\n    1477, 1471, 1463, 434, 1437, 1196, 852, 584, 554, 3153, 548, \r\n    2179, 2365, 1950, 671, 1920, 1918, 1349, 764, 3820, 1827, 754, \r\n    3409, 2495, 2393, 2955, 2298, 1918, 158, 1870, 1750, 1288, 1339, \r\n    643, 761, 736, 496, 2758, 4088, 2181, 3021, 1903, 1001, 807, \r\n    770, 550, 2619, 1352, 1365, 1288, 1154, 337, 255, 456, 395, 321, \r\n    344, 397, 644, 550, 253, 289, 404, 379, 358, 326, 334, 268, 723, \r\n......\r\n    \"chemotherapy\", \"chemotherapy\", \"chemotherapy\", \"chemotherapy\", \r\n    \"chemotherapy\", \"hormone therapy\", \"hormone therapy\", \"chemotherapy\", \r\n    \"chemotherapy\", \"hormone therapy\", \"chemotherapy\", \"hormone therapy\", \r\n    \"hormone therapy\", \"hormone therapy\", \"hormone therapy\", \"chemotherapy\", \r\n    \"chemotherapy\")), class = \"data.frame\", row.names = c(NA, -760L\r\n    ), .Names = c(\"times\", \"bcr_patient_barcode\", \"patient.vital_status\", \r\n    \"therapy\")))\r\n\r\n                              n events median 0.95LCL 0.95UCL\r\n    therapy=chemotherapy    487     18     NA      NA      NA\r\n    therapy=hormone therapy 273      7     NA      NA      NA\r\n\r\nSession info\r\n============\r\n\r\n``` r\r\ndevtools::session_info()\r\n```\r\n\r\n     setting  value                       \r\n     version  R version 3.3.1 (2016-06-21)\r\n     system   x86_64, linux-gnu           \r\n     ui       X11                         \r\n     language English                     \r\n     collate  pl_PL.UTF-8                 \r\n     tz       <NA>                        \r\n     date     2016-12-01                  \r\n\r\n     package        * version      date       source                               \r\n     assertthat       0.1          2013-12-06 CRAN (R 3.3.1)                       \r\n     backports        1.0.4        2016-10-24 CRAN (R 3.3.1)                       \r\n     colorspace       1.3-1        2016-11-18 CRAN (R 3.3.1)                       \r\n     data.table       1.9.8        2016-11-25 CRAN (R 3.3.1)                       \r\n     DBI              0.5-1        2016-09-10 CRAN (R 3.3.1)                       \r\n     devtools         1.12.0       2016-06-24 CRAN (R 3.3.1)                       \r\n     digest           0.6.10       2016-08-02 CRAN (R 3.3.1)                       \r\n     dplyr          * 0.5.0        2016-06-24 CRAN (R 3.3.1)                       \r\n     evaluate         0.10         2016-10-11 cran (@0.10)                         \r\n     ggplot2          2.2.0        2016-11-11 CRAN (R 3.3.1)                       \r\n     ggthemes         3.3.0        2016-11-24 CRAN (R 3.3.1)                       \r\n     gridExtra        2.2.1        2016-02-29 CRAN (R 3.3.1)                       \r\n     gtable           0.2.0        2016-02-26 CRAN (R 3.3.1)                       \r\n     htmltools        0.3.5        2016-03-21 CRAN (R 3.3.1)                       \r\n     httr             1.2.1        2016-07-03 CRAN (R 3.3.1)                       \r\n     knitr          * 1.15.1       2016-11-22 CRAN (R 3.3.1)                       \r\n     lattice          0.20-34      2016-09-06 CRAN (R 3.3.1)                       \r\n     lazyeval         0.2.0        2016-06-12 CRAN (R 3.3.1)                       \r\n     magrittr         1.5          2014-11-22 CRAN (R 3.3.1)                       \r\n     Matrix           1.2-7.1      2016-09-01 CRAN (R 3.3.1)                       \r\n     memoise          1.0.0        2016-01-29 CRAN (R 3.3.1)                       \r\n     munsell          0.4.3        2016-02-13 CRAN (R 3.3.1)                       \r\n     plyr             1.8.4        2016-06-08 CRAN (R 3.3.1)                       \r\n     purrr            0.2.2        2016-06-18 CRAN (R 3.3.1)                       \r\n     R6               2.2.0        2016-10-05 CRAN (R 3.3.1)                       \r\n     Rcpp             0.12.8       2016-11-17 CRAN (R 3.3.1)                       \r\n     rmarkdown        1.2          2016-11-21 CRAN (R 3.3.1)                       \r\n     rprojroot        1.1          2016-10-29 CRAN (R 3.3.1)                       \r\n     RTCGA          * 1.5.0        2016-12-01 Bioconductor (R 3.3.1)               \r\n     RTCGA.clinical * 20151101.4.0 2016-11-30 Bioconductor (R 3.3.1)               \r\n     rvest            0.3.2        2016-06-17 CRAN (R 3.3.1)                       \r\n     scales           0.4.1        2016-11-09 CRAN (R 3.3.1)                       \r\n     stringi          1.1.2        2016-10-01 CRAN (R 3.3.1)                       \r\n     stringr          1.1.0        2016-08-19 CRAN (R 3.3.1)                       \r\n     survival       * 2.40-1       2016-10-30 CRAN (R 3.3.1)                       \r\n     survminer        0.2.2.999    2016-11-23 Github (kassambara/survminer@56614b2)\r\n     tibble           1.2          2016-08-26 CRAN (R 3.3.1)                       \r\n     viridis          0.3.4        2016-03-12 CRAN (R 3.3.1)                       \r\n     withr            1.0.2        2016-06-20 CRAN (R 3.3.1)                       \r\n     XML              3.98-1.5     2016-11-10 CRAN (R 3.3.1)                       \r\n     xml2             1.0.0        2016-06-24 CRAN (R 3.3.1)                       \r\n     yaml             2.1.14       2016-11-12 CRAN (R 3.3.1)\r\n"}}
{"actor":{"display_login":"MarcinKosinski"}}