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

Additional data= argument in survminer functions #142

Closed
kassambara opened this issue Feb 2, 2017 · 3 comments
Closed

Additional data= argument in survminer functions #142

kassambara opened this issue Feb 2, 2017 · 3 comments

Comments

@kassambara
Copy link
Owner

@kassambara kassambara commented Feb 2, 2017

I'm updating survminer functions to use the .get_data() [ by @pbiecek ] function instead of eval(fit$call$data) .

kassambara added a commit that referenced this issue Feb 2, 2017
kassambara added a commit that referenced this issue Feb 2, 2017
kassambara added a commit that referenced this issue Feb 2, 2017
kassambara added a commit that referenced this issue Feb 2, 2017
@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 2, 2017

Should be ok now!

ggsurvplot() should be used as follow:

require("survival")
fit<- survfit(Surv(time, status) ~ sex, data = lung)

# Drawing survival curves
ggsurvplot(fit, data = lung)
@kassambara kassambara closed this Feb 2, 2017
kassambara added a commit that referenced this issue Feb 2, 2017
@MarcinKosinski
Copy link
Contributor

@MarcinKosinski MarcinKosinski commented Feb 4, 2017

I am having such varning right now when I use survminer

code

devtools::install_github('kassambara/survminer')
library(survminer)
library(survival)
fit <- survfit(Surv(time, status) ~ sex, data = lung)

ggsurvplot(fit, data = lung,
  main = "Survival curves", submain = "Based on Kaplan-Meier estimates",
  caption = "created with survminer",
  font.main = c(16, "bold", "darkblue"),
  font.submain = c(15, "bold.italic", "purple"),
  font.caption = c(14, "plain", "orange"),
  font.x = c(14, "bold.italic", "red"),
  font.y = c(14, "bold.italic", "darkred"),
  font.tickslab = c(12, "plain", "darkgreen"),
  ########## risk table #########,
  risk.table = TRUE,
  risk.table.title = "Note the risk set sizes",
  risk.table.subtitle = "and remember about censoring.",
  risk.table.caption = "source code: website.com",
  risk.table.height = 0.35,
  font.risk.table.title = c(13, "bold.italic", "green"),
  font.risk.table.sutitle = c(15, "bold", "pink"),
  font.risk.table.caption = c(11, "plain", "darkgreen"),
  font.risk.table.x = c(8, "bold.italic", "orange"),
  font.risk.table.y = c(11, "bold.italic", "darkgreen"),
  font.risk.table.tickslab = c(9, "bold", "red"),
  ######### ncensor plot ###################
  ncensor.plot = TRUE,
  ncensor.plot.title = "Number of censorings",
  ncensor.plot.subtitle = "over the time.",
  ncensor.plot.caption = "data available at data.com",
  ncensor.plot.height = 0.35,
  font.ncensor.plot.title = c(13, "bold.italic", "green"),
  font.ncensor.plot.sutitle = c(15, "bold", "pink"),
  font.ncensor.plot.caption = c(11, "plain", "darkgreen"),
  font.ncensor.plot.x = c(8, "bold.italic", "orange"),
  font.ncensor.plot.y = c(11, "bold.italic", "darkgreen"),
  font.ncensor.plot.tickslab = c(9, "bold", "red"))

results

> library(survminer)
Loading required package: ggplot2
> ?ggsurvplot
> fit <- survfit(Surv(time, status) ~ sex, data = lung)
Error: could not find function "survfit"
> library(survival)
> fit <- survfit(Surv(time, status) ~ sex, data = lung)
> ggsurvplot(fit, data = lung,
+   main = "Survival curves", submain = "Based on Kaplan-Meier estimates",
+   caption = "created with survminer",
+   font.main = c(16, "bold", "darkblue"),
+   font.submain = c(15, "bold.italic", "purple"),
+   font.caption = c(14, "plain", "orange"),
+   font.x = c(14, "bold.italic", "red"),
+   font.y = c(14, "bold.italic", "darkred"),
+   font.tickslab = c(12, "plain", "darkgreen"),
+   ########## risk table #########,
+   risk.table = TRUE,
+   risk.table.title = "Note the risk set sizes",
+   risk.table.subtitle = "and remember about censoring.",
+   risk.table.caption = "source code: website.com",
+   risk.table.height = 0.35,
+   font.risk.table.title = c(13, "bold.italic", "green"),
+   font.risk.table.sutitle = c(15, "bold", "pink"),
+   font.risk.table.caption = c(11, "plain", "darkgreen"),
+   font.risk.table.x = c(8, "bold.italic", "orange"),
+   font.risk.table.y = c(11, "bold.italic", "darkgreen"),
+   font.risk.table.tickslab = c(9, "bold", "red"),
+   ######### ncensor plot ###################
+   ncensor.plot = TRUE,
+   ncensor.plot.title = "Number of censorings",
+   ncensor.plot.subtitle = "over the time.",
+   ncensor.plot.caption = "data available at data.com",
+   ncensor.plot.height = 0.35,
+   font.ncensor.plot.title = c(13, "bold.italic", "green"),
+   font.ncensor.plot.sutitle = c(15, "bold", "pink"),
+   font.ncensor.plot.caption = c(11, "plain", "darkgreen"),
+   font.ncensor.plot.x = c(8, "bold.italic", "orange"),
+   font.ncensor.plot.y = c(11, "bold.italic", "darkgreen"),
+   font.ncensor.plot.tickslab = c(9, "bold", "red"))
Warning messages:
1: In if (value %in% columns) { :
  the condition has length > 1 and only the first element will be used
2: In if (value %in% columns) { :
  the condition has length > 1 and only the first element will be used
@kassambara
Copy link
Owner Author

@kassambara kassambara commented Feb 4, 2017

In your R code, you used :

font.risk.table.sutitle and font.ncensor.plot.sutitle instead of font.risk.table.subtitle and font.ncensor.plot.subtitle.

It should work after updating the names of the two arguments in your script...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.