Displaying 7 results from an estimated 7 matches for "ggsurvplot".
2018 Jan 15
2
consolidate three function into one
Hi Richard,
Thank you so much!! I understand the problem now, I assign a name to the "ggsurvplot" object and then add print(fig) at bottom of function definition, now figure gets printed on screen.
Ding
# function to generate RFS curves
RFS <- function( inputfile, N ) {
cluster<- survfit(Surv(RFS_days2, OV_Had_a_Recurrence_CODE) ~ clusters,
data = inputfile)...
2018 Jan 15
0
consolidate three function into one
That is certainly OK, but you can also just use
print(ggsurvplot(...))
as your final statement.
out <- RFS( ...)
would then return the ggsurvplot object *and* graph it.
Any good R tutorial or a web search will provide more details on function
returns, which you might find useful.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is...
2018 Jan 15
1
consolidate three function into one
...to:bgunter.4567 at gmail.com]
Sent: Monday, January 15, 2018 10:11 AM
To: Ding, Yuan Chun <ycding at coh.org>
Cc: Richard M. Heiberger <rmh at temple.edu>; r-help at r-project.org
Subject: Re: [R] consolidate three function into one
That is certainly OK, but you can also just use
print(ggsurvplot(...))
as your final statement.
out <- RFS( ...)
would then return the ggsurvplot object *and* graph it.
Any good R tutorial or a web search will provide more details on function returns, which you might find useful.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is tha...
2018 Jan 14
2
consolidate three function into one
...}
else {palette <- c("red", "black","green", "blue")
legend.labs <- c("Cluster1", "Cluster2", "Cluster3", "Cluster4")
}
ggsurvplot(cluster, data = inputfile, risk.table = F,
palette = palette,
ylim=c(0,1),ggtheme = theme_bw(),xlab="Relapse Free Suvival (Days)",
main = "Survival curve",pval = TRUE,font.x = 16,font.y = 16,
font.tickslab = 14,font.legend =c(...
2018 Jan 14
0
consolidate three function into one
...gt; else {palette <- c("red", "black","green", "blue")
> legend.labs <- c("Cluster1", "Cluster2", "Cluster3", "Cluster4")
> }
>
> ggsurvplot(cluster, data = inputfile, risk.table = F,
> palette = palette,
> ylim=c(0,1),ggtheme = theme_bw(),xlab="Relapse Free Suvival (Days)",
> main = "Survival curve",pval = TRUE,font.x = 16,font.y = 16,
> font.tickslab...
2018 Jan 14
0
consolidate three function into one
...functions? I thought about using if else function, but not sure how to do it.
Thank you,
Ding
# function to generate RFS
RFS2cluster <- function( inputfile ) {
cluster2<- survfit(Surv(RFS_days, OV_Had_a_Recurrence_CODE) ~ clusters,
data = inputfile)
ggsurvplot(cluster2, data = inputfile, risk.table = F,
palette = c("red", "black"),
ylim=c(0,1),
ggtheme = theme_bw(),
xlab="Relapse Free Suvival (Days)",
main = "Survival curve",
pval = TRUE,...
2018 Jan 14
0
consolidate three function into one
...ne functions? I thought about using if else function, but not sure how to do it.
Thank you,
Ding
# function to generate RFS
RFS2cluster <- function( inputfile ) {
cluster2<- survfit(Surv(RFS_days, OV_Had_a_Recurrence_CODE) ~ clusters,
data = inputfile)
ggsurvplot(cluster2, data = inputfile, risk.table = F,
palette = c("red", "black"),
ylim=c(0,1),
ggtheme = theme_bw(),
xlab="Relapse Free Suvival (Days)",
main = "Survival curve",
pval = TRUE,...