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
Added support of survfitms #177
Conversation
R/fortify_surv.R:72:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(strata)),]
^ R/fortify_surv.R:79:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(events)),]
^ R/fortify_surv.R:83:32: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:43: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:51: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:107:11: style: Commas should always have a space after. d <- d[,intersect(c(
^ R/fortify_surv.R:205:18: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:205:41: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:207:41: style: Commas should always have a space after. group.levels <- lapply(plot.data[,group], levels)
^ R/fortify_surv.R:209:45: style: Commas should always have a space after. group.data <- factor(apply(plot.data[,group], 1, function(x) paste(x, collapse = ' ')), levels = group.levels)
^ R/fortify_surv.R:210:18: style: Commas should always have a space after. plot.data[,'group'] <- group.data
^ R/fortify_surv.R:214:60: style: Place a space before left parenthesis, except in a function call. if ('event' %in% colnames(plot.data)) 'event' else if(grid) '.',
^ R/fortify_surv.R:215:62: style: Place a space before left parenthesis, except in a function call. if ('strata' %in% colnames(plot.data)) 'strata' else if(grid) '.')
^ tests/testthat/test-surv.R:170:73: style: Commas should never have a space before. event = c(1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ tests/testthat/test-surv.R:194:86: style: Commas should never have a space before. event = c(1, 2, 'any', 1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ |
R/fortify_surv.R:72:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(strata)),]
^ R/fortify_surv.R:79:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(events)),]
^ R/fortify_surv.R:83:32: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:43: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:51: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:107:11: style: Commas should always have a space after. d <- d[,intersect(c(
^ R/fortify_surv.R:205:18: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:205:41: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:207:41: style: Commas should always have a space after. group.levels <- lapply(plot.data[,group], levels)
^ R/fortify_surv.R:209:45: style: Commas should always have a space after. group.data <- factor(apply(plot.data[,group], 1, function(x) paste(x, collapse = ' ')), levels = group.levels)
^ R/fortify_surv.R:210:18: style: Commas should always have a space after. plot.data[,'group'] <- group.data
^ R/fortify_surv.R:214:60: style: Place a space before left parenthesis, except in a function call. if ('event' %in% colnames(plot.data)) 'event' else if(grid) '.',
^ R/fortify_surv.R:215:62: style: Place a space before left parenthesis, except in a function call. if ('strata' %in% colnames(plot.data)) 'strata' else if(grid) '.')
^ tests/testthat/test-surv.R:170:73: style: Commas should never have a space before. event = c(1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ tests/testthat/test-surv.R:194:86: style: Commas should never have a space before. event = c(1, 2, 'any', 1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ |
1 similar comment
R/fortify_surv.R:72:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(strata)),]
^ R/fortify_surv.R:79:61: style: Commas should always have a space after. base <- base[rep(seq_len(nrow(base)), length(events)),]
^ R/fortify_surv.R:83:32: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:43: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:83:51: style: Commas should always have a space after. base[base$event == 'any',c('pstate','upper','lower')] <- 1.0
^ R/fortify_surv.R:107:11: style: Commas should always have a space after. d <- d[,intersect(c(
^ R/fortify_surv.R:205:18: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:205:41: style: Commas should always have a space after. plot.data[,'group'] <- plot.data[,group]
^ R/fortify_surv.R:207:41: style: Commas should always have a space after. group.levels <- lapply(plot.data[,group], levels)
^ R/fortify_surv.R:209:45: style: Commas should always have a space after. group.data <- factor(apply(plot.data[,group], 1, function(x) paste(x, collapse = ' ')), levels = group.levels)
^ R/fortify_surv.R:210:18: style: Commas should always have a space after. plot.data[,'group'] <- group.data
^ R/fortify_surv.R:214:60: style: Place a space before left parenthesis, except in a function call. if ('event' %in% colnames(plot.data)) 'event' else if(grid) '.',
^ R/fortify_surv.R:215:62: style: Place a space before left parenthesis, except in a function call. if ('strata' %in% colnames(plot.data)) 'strata' else if(grid) '.')
^ tests/testthat/test-surv.R:170:73: style: Commas should never have a space before. event = c(1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ tests/testthat/test-surv.R:194:86: style: Commas should never have a space before. event = c(1, 2, 'any', 1, 1, 1, 1, 2, 2, 2, 2, 'any', 'any' , 'any', 'any'))
~^ |
Thanks for the PR. Could you fix the Travis failure? |
@sinhrks Everything should be ok now. I don't understand why Travis build failed, there's 0 warnings and errors. |
Thx! A warning is raised because of a doc issue. |
@@ -114,7 +159,9 @@ autoplot.survfit <- function(object, fun = NULL, | |||
conf.int.fill = '#000000', conf.int.alpha = 0.3, | |||
censor = TRUE, censor.colour = NULL, censor.size = 3, | |||
censor.alpha = NULL, censor.shape = '+', | |||
facets = FALSE, nrow = NULL, ncol = 1, scales = 'free_y', | |||
facets = FALSE, nrow = NULL, ncol = 1, | |||
grid = FALSE, strip_swap = FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can u add docs for grid
and strip_swap
?
Thanks! I'll fix the doc issue. |
Greetings.
This PR adds support of survfitms - multistate survival models built using
Surv(..., type = 'mstate')
.Here is an overview of changes to
fortify
:surv
orpstate
) it is added to the end of the output data.frame;surv.connect = T
new rows are repeated according to number of states;To
autoplot
:facet_grid
support - argumentgrid
. It's more convenient for 2-dim set plots;strip_swap
;conf.int.group = NULL
was added toplot_confint
. It's required to split CI ribbons by both - event and strata, because it can't be done withfill
only;group
is assembled inautoplot
.Feedback or questions are welcome.