-
-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Description
g_lineplot() is re-setting the factor level in strata.
adsl <- scda::synthetic_cdisc_data("latest")$adsl
adlb <- scda::synthetic_cdisc_data("latest")$adlb
adlb <- dplyr::filter(adlb, ANL01FL == "Y", PARAMCD == "ALT", AVISIT != "SCREENING")
adlb$AVISIT <- droplevels(adlb$AVISIT)
adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min))
unique(adlb$ARM)
[1] A: Drug X C: Combination B: Placebo
Levels: A: Drug X B: Placebo C: Combination
adlb <- adlb %>% mutate(ARM1 = factor(ARM, levels = c("B: Placebo", "C: Combination", "A: Drug X")))
unique(adlb$ARM1)
[1] A: Drug X C: Combination B: Placebo
Levels: B: Placebo C: Combination A: Drug X
tern::g_lineplot(
adlb, strata = ARM,
whiskers = "mean_ci_upr",
title = "Plot of Mean and Upper 95% Confidence Limit by Visit"
)
tern::g_lineplot(
adlb, strata = ARM1,
whiskers = "mean_ci_upr",
title = "Plot of Mean and Upper 95% Confidence Limit by Visit"
)
The level of ARM and ARM1 are different, but the outputs are the same.
