forked from kassambara/survminer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kassambara#578 update tests and replace a few select and as.tibbles
- Loading branch information
1 parent
c4a3de1
commit 359c0c0
Showing
4 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
test_that("ggsurvplot_facet creates the correct quanitty of subplots", { | ||
fit <- survfit(Surv(time, status) ~ sex, data=kidney) | ||
p <- ggsurvplot_facet(fit, kidney, facet.by='disease') | ||
.build <- ggplot_build(p) | ||
expect_equal(nrow(.build$data[[2]]), | ||
length(unique(kidney[['disease']]))) | ||
|
||
fit <- survfit(Surv(time, status) ~ disease, data=kidney) | ||
p <- ggsurvplot_facet(fit, kidney, facet.by='sex') | ||
.build <- ggplot_build(p) | ||
expect_equal(nrow(.build$data[[2]]), | ||
length(unique(kidney[['sex']]))) | ||
}) | ||
|
||
test_that("ggsurvplot_facet calculates pvalue for each facet", { | ||
fit <- survfit(Surv(time, status) ~ sex, data=kidney) | ||
p <- ggsurvplot_facet(fit, kidney, facet.by='disease', pval = TRUE) | ||
.build <- ggplot_build(p) | ||
expect_equal(nrow(.build$plot$layer[[4]][['data']]), | ||
length(unique(kidney[['disease']]))) | ||
}) |