Skip to content

Commit

Permalink
Update plot.projoint_results.R
Browse files Browse the repository at this point in the history
Fixed a minor but important error!! "level1" (baseline) --> "level1$"
  • Loading branch information
yhoriuchi committed Aug 15, 2023
1 parent 638b949 commit 03c23f2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/plot.projoint_results.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ plot.projoint_results <- function(

levels1 <- x@labels %>%
dplyr::select(attribute, level, level_id) %>%
dplyr::filter(str_detect(level_id, "level1"))
dplyr::filter(str_detect(level_id, "level1$"))

out2 <- bind_rows(
out1,
Expand All @@ -139,8 +139,8 @@ plot.projoint_results <- function(
attributes %>% dplyr::mutate(estimates = "uncorrected")
) %>%
dplyr::arrange(level_id) %>%
dplyr::mutate(estimate = ifelse(stringr::str_detect(level_id, "level1"), 0, estimate),
se = ifelse(stringr::str_detect(level_id, "level1"), 0, se)) %>%
dplyr::mutate(estimate = ifelse(stringr::str_detect(level_id, "level1$"), 0, estimate),
se = ifelse(stringr::str_detect(level_id, "level1$"), 0, se)) %>%
dplyr::select(-baseline)


Expand Down Expand Up @@ -221,14 +221,14 @@ plot.projoint_results <- function(
} else if (.estimand == "amce"){

g + ggplot2::geom_pointrange(data = out4 %>%
dplyr::filter(!stringr::str_detect(level_id, "level1")),
dplyr::filter(!stringr::str_detect(level_id, "level1$")),
aes(x = estimate,
xmin = conf.low,
xmax = conf.high,
y = order),
na.rm = TRUE) +
ggplot2::geom_pointrange(data = out4 %>%
dplyr::filter(stringr::str_detect(level_id, "level1")),
dplyr::filter(stringr::str_detect(level_id, "level1$")),
aes(x = estimate,
xmin = estimate,
xmax = estimate,
Expand Down Expand Up @@ -256,7 +256,7 @@ plot.projoint_results <- function(
} else if (.estimand == "amce"){

g + ggplot2::geom_pointrange(data = out4 %>%
dplyr::filter(!stringr::str_detect(level_id, "level1")),
dplyr::filter(!stringr::str_detect(level_id, "level1$")),
aes(x = estimate,
xmin = conf.low,
xmax = conf.high,
Expand All @@ -265,7 +265,7 @@ plot.projoint_results <- function(
position = ggplot2::position_dodge(width = 0.5),
na.rm = TRUE) +
ggplot2::geom_pointrange(data = out4 %>%
dplyr::filter(stringr::str_detect(level_id, "level1")),
dplyr::filter(stringr::str_detect(level_id, "level1$")),
aes(x = estimate,
xmin = estimate,
xmax = estimate,
Expand Down

0 comments on commit 03c23f2

Please sign in to comment.