kassambara / survminer

Survival Analysis and Visualization
https://rpkgs.datanovia.com/survminer/
504 stars 162 forks source link

question on survminer visualizing survival curves #210

Closed kibtes closed 7 years ago

kibtes commented 7 years ago

I was following your Survival Analysis Basics Tutorial and while trying to execute the plotting under the visualizing survival curves section

Expected behavior

image

Actual behavior

Error in as.vector(y) : attempt to apply non-function
In addition: Warning message:
In .get_data(fit, data = data) :
  The `data` argument is not provided. Data will be extracted from model fit.

But the second visualizing curve works yet it stills the following warning message

Warning message:
In .get_data(fit, data = data) :
  The `data` argument is not provided. Data will be extracted from model fit.

session_info()

# please paste here the result of
sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] survminer_0.3.1 ggpubr_0.1.2    ggplot2_2.1.0   survival_2.41-3

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.6      km.ci_0.5-2      knitr_1.14       magrittr_1.5     splines_3.3.2    mnormt_1.5-5     munsell_0.4.3   
 [8] xtable_1.8-2     colorspace_1.2-6 lattice_0.20-34  KMsurv_0.1-5     R6_2.1.3         stringr_1.1.0    plyr_1.8.4      
[15] dplyr_0.5.0      cmprsk_2.2-7     tools_3.3.2      parallel_3.3.2   grid_3.3.2       data.table_1.9.6 broom_0.4.2     
[22] gtable_0.2.0     nlme_3.1-128     psych_1.7.5      DBI_0.5-1        survMisc_0.5.4   digest_0.6.10    assertthat_0.1  
[29] tibble_1.2       Matrix_1.2-7.1   gridExtra_2.2.1  tidyr_0.6.0      reshape2_1.4.1   labeling_0.3     stringi_1.1.1   
[36] scales_0.4.0     chron_2.3-47     foreign_0.8-67   zoo_1.7-14
kassambara commented 7 years ago

Please install the latest developmental version from github, and let me know if it still fails.

To avoid the warning, please specify the argument data to the ggsurvplot() function.

kibtes commented 7 years ago

Thank you for your prompt response. The developmental version from github works.

kassambara commented 7 years ago

Great, so we can close this issue

kibtes commented 7 years ago

Following the Tutorial on Cox proportional hazard regression am having an error while trying to compute the following line of code ggsurvplot(survfit(res.cox),color="#2E9FDF",ggtheme=theme_minimal())

Expected Result: image

Actual Result:

Error: object of type 'symbol' is not subsettable
In addition: Warning message:
color should be a coloring variable name. To change color palette, use the argument palette= '#2E9FDF'.

to avoid the warning message i changed the color to palette. But can't really understand the error. and my session info is

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
 [1] survminer_0.3.1.999  ggpubr_0.1.2.999     ggplot2_2.2.1        devtools_1.12.0      survival_2.41-3     
 [6] RevoUtilsMath_10.0.0 RevoUtils_10.0.2     RevoMods_10.0.0      MicrosoftML_1.0.0    mrsdeploy_1.0       
[11] RevoScaleR_9.0.1     lattice_0.20-34      rpart_4.1-10        

loaded via a namespace (and not attached):
 [1] zoo_1.7-14             reshape2_1.4.1         purrr_0.2.2            splines_3.3.2          colorspace_1.2-6      
 [6] CompatibilityAPI_1.1.0 chron_2.3-47           survMisc_0.5.4         foreign_0.8-67         withr_1.0.2           
[11] DBI_0.5-1              foreach_1.4.3          plyr_1.8.4             stringr_1.1.0          munsell_0.4.3         
[16] gtable_0.2.0           codetools_0.2-15       psych_1.7.5            memoise_1.0.0          labeling_0.3          
[21] knitr_1.14             mrupdate_1.0.0         curl_2.3               parallel_3.3.2         broom_0.4.2           
[26] Rcpp_0.12.6            xtable_1.8-2           scales_0.4.1           cmprsk_2.2-7           jsonlite_1.2          
[31] km.ci_0.5-2            gridExtra_2.2.1        mnormt_1.5-5           digest_0.6.10          stringi_1.1.1         
[36] dplyr_0.5.0            KMsurv_0.1-5           grid_3.3.2             tools_3.3.2            magrittr_1.5          
[41] lazyeval_0.2.0         tibble_1.3.0           tidyr_0.6.2            Matrix_1.2-7.1         data.table_1.9.6      
[46] rstudioapi_0.6         assertthat_0.1         httr_1.2.1             iterators_1.0.8        R6_2.1.3              
[51] nlme_3.1-128           git2r_0.18.0     
kassambara commented 7 years ago

th

kassambara commented 7 years ago

Thank you for pointing this out. I'll fix this as soon as possible.