Skip to content

Commit 4c58fe5

Browse files
committed
Address reviewer comments
1 parent 451cbc4 commit 4c58fe5

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

R/tm_g_association.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ srv_tm_g_association <- function(id,
504504
expr = {
505505
plot_top <- plot_calls[[1]]
506506
plot_bottom <- plot_calls[[1]]
507-
plot <- tern::stack_grobs(grobs = lapply(list(plot_top, plot_bottom), ggplotGrob))
507+
plot <- tern::stack_grobs(grobs = lapply(list(plot_top, plot_bottom), ggplot2::ggplotGrob))
508508
},
509509
env = list(
510510
plot_calls = do.call(

R/tm_g_scatterplotmatrix.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ srv_g_scatterplotmatrix <- function(id,
329329

330330
anl_merged_q <- reactive({
331331
req(anl_merged_input())
332-
data() %>%
333-
teal.code::eval_code(as.expression(anl_merged_input()$expr))
332+
qenv <- teal.code::eval_code(data(), 'library("dplyr");library("lattice")') # nolint quotes
333+
teal.code::eval_code(qenv, as.expression(anl_merged_input()$expr))
334334
})
335335

336336
merged <- list(
@@ -366,6 +366,7 @@ srv_g_scatterplotmatrix <- function(id,
366366

367367
# check character columns. If any, then those are converted to factors
368368
check_char <- vapply(ANL[, cols_names], is.character, logical(1))
369+
qenv <- teal.code::eval_code(qenv, 'library("dplyr");library("lattice")') # nolint quotes
369370
if (any(check_char)) {
370371
qenv <- teal.code::eval_code(
371372
qenv,

R/tm_missing_data.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ srv_missing_data <- function(id,
533533
group_var <- input$group_by_var
534534
anl <- data_r()
535535
qenv <- teal.code::eval_code(data(), {
536-
'library("dplyr");library("ggplot2");library("tidyr");library("forcats");library("glue")'
536+
'library("dplyr");library("ggplot2");library("tidyr");library("gridExtra")' # nolint quotes
537537
})
538538

539539
qenv <- if (!is.null(selected_vars()) && length(selected_vars()) != ncol(anl)) {
@@ -927,14 +927,14 @@ srv_missing_data <- function(id,
927927

928928
if (isTRUE(input$if_patients_plot)) {
929929
within(qenv, {
930-
g1 <- ggplotGrob(summary_plot_top)
931-
g2 <- ggplotGrob(summary_plot_bottom)
930+
g1 <- ggplot2::ggplotGrob(summary_plot_top)
931+
g2 <- ggplot2::ggplotGrob(summary_plot_bottom)
932932
summary_plot <- gridExtra::gtable_cbind(g1, g2, size = "first")
933933
summary_plot$heights <- grid::unit.pmax(g1$heights, g2$heights)
934934
})
935935
} else {
936936
within(qenv, {
937-
g1 <- ggplotGrob(summary_plot_top)
937+
g1 <- ggplot2::ggplotGrob(summary_plot_top)
938938
summary_plot <- g1
939939
})
940940
}
@@ -1067,8 +1067,8 @@ srv_missing_data <- function(id,
10671067
)
10681068

10691069
within(qenv, {
1070-
g1 <- ggplotGrob(combination_plot_top)
1071-
g2 <- ggplotGrob(combination_plot_bottom)
1070+
g1 <- ggplot2::ggplotGrob(combination_plot_top)
1071+
g2 <- ggplot2::ggplotGrob(combination_plot_bottom)
10721072

10731073
combination_plot <- gridExtra::gtable_rbind(g1, g2, size = "last")
10741074
combination_plot$heights[7] <- grid::unit(0.2, "null") # rescale to get the bar chart smaller
@@ -1112,8 +1112,11 @@ srv_missing_data <- function(id,
11121112
}
11131113

11141114
qenv <- if (!is.null(group_var)) {
1115+
common_code_libraries_q <- teal.code::eval_code(common_code_q(),
1116+
'library("forcats");library("glue");library("rlistings")' # nolint quotes
1117+
)
11151118
teal.code::eval_code(
1116-
common_code_q(),
1119+
common_code_libraries_q,
11171120
substitute(
11181121
expr = {
11191122
summary_data <- ANL %>%

R/tm_outliers.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
439439

440440
anl_merged_q <- reactive({
441441
req(anl_merged_input())
442-
data() %>%
442+
teal.code::eval_code(data(),
443+
paste0(
444+
'library("dplyr");library("tidyr");', # nolint quotes
445+
'library("tibble");library("ggplot2");library("rlistings")')) %>% # nolint quotes
443446
teal.code::eval_code(as.expression(anl_merged_input()$expr))
444447
})
445448

R/tm_variable_browser.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ plot_var_summary <- function(var,
818818
theme = do.call("theme", all_ggplot2_args$theme)
819819
)
820820
}
821-
plot_main <- ggplotGrob(plot_main)
821+
plot_main <- ggplot2::ggplotGrob(plot_main)
822822
}
823823

824824
grid::grid.draw(plot_main)

R/utils.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ add_facet_labels <- function(p, xfacet_label = NULL, yfacet_label = NULL) {
9090
checkmate::assert_character(xfacet_label, null.ok = TRUE, min.len = 1)
9191
checkmate::assert_character(yfacet_label, null.ok = TRUE, min.len = 1)
9292
if (is.null(xfacet_label) && is.null(yfacet_label)) {
93-
return(ggplotGrob(p))
93+
return(ggplot2::ggplotGrob(p))
9494
}
9595
grid::grid.grabExpr({
96-
g <- ggplotGrob(p)
96+
g <- ggplot2::ggplotGrob(p)
9797

9898
# we are going to replace these, so we make sure they have nothing in them
9999
checkmate::assert_class(g$grobs[[grep("xlab-t", g$layout$name, fixed = TRUE)]], "zeroGrob")

0 commit comments

Comments
 (0)