Skip to content

Commit

Permalink
Merge 1903f72 into 16f3a0a
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades authored Feb 9, 2023
2 parents 16f3a0a + 1903f72 commit fc4af48
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ g_lineplot <- function(df, # nolint
df_grp <- tidyr::expand(df, NULL, .data[[x]])
}
df_grp <- df_grp %>%
dplyr::full_join(y = df[, c(strata, x, y)], by = c(strata, x)) %>%
dplyr::full_join(y = df[, c(strata, x, y)], by = c(strata, x), multiple = "all") %>%
dplyr::group_by_at(c(strata, x))

df_stats <- df_grp %>%
Expand Down
23 changes: 23 additions & 0 deletions tests/testthat/test-g_lineplot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
adsl <- tern_ex_adsl
adlb <- tern_ex_adlb %>% dplyr::filter(ANL01FL == "Y", PARAMCD == "ALT", AVISIT != "SCREENING")
adlb$AVISIT <- droplevels(adlb$AVISIT)
adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min))

testthat::test_that("g_lineplot works with default settings", {
testthat::expect_silent(g_lineplot(adlb, adsl))
})

testthat::test_that("g_lineplot works with custom settings and statistics table", {
testthat::expect_silent(g_lineplot(
adlb,
adsl,
strata = control_lineplot_vars(strata = NULL),
mid = "median",
table = c("n", "mean", "mean_ci"),
control = control_summarize_vars(conf_level = 0.80),
title = "Plot of Mean and 80% Confidence Limits by Visit",
y_lab = "Lab Test",
subtitle = "Laboratory Test:",
caption = "caption"
))
})

0 comments on commit fc4af48

Please sign in to comment.