Skip to content

Commit 4748b1c

Browse files
authored
use expression when loading libraries
Signed-off-by: Marcin <[email protected]>
1 parent 9db797d commit 4748b1c

File tree

10 files changed

+18
-20
lines changed

10 files changed

+18
-20
lines changed

R/tm_a_pca.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ srv_a_pca <- function(id, data, dat, plot_height, plot_width, ggplot2_args, deco
440440
teal.reporter::teal_card(obj),
441441
teal.reporter::teal_card("## Module's code")
442442
)
443-
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("tidyr")') # nolint: quotes.
443+
teal.code::eval_code(obj, expression(library("ggplot2"), library("dplyr"), library("tidyr"))
444444
})
445445
anl_merged_q <- reactive({
446446
req(anl_merged_input())

R/tm_a_regression.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ srv_a_regression <- function(id,
465465
teal.reporter::teal_card(obj),
466466
teal.reporter::teal_card("## Module's code")
467467
)
468-
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr")') # nolint: quotes.
468+
teal.code::eval_code(obj, expression(library("ggplot2"), library("dplyr")))
469469
})
470470

471471
anl_merged_q <- reactive({
@@ -986,7 +986,7 @@ srv_a_regression <- function(id,
986986

987987
output_q <- reactive({
988988
teal::validate_inputs(iv_r())
989-
obj <- switch(input$plot_type,
989+
switch(input$plot_type,
990990
"Response vs Regressor" = output_plot_0(),
991991
"Residuals vs Fitted" = output_plot_1(),
992992
"Normal Q-Q" = output_plot_2(),
@@ -995,7 +995,6 @@ srv_a_regression <- function(id,
995995
"Residuals vs Leverage" = output_plot_5(),
996996
"Cook's dist vs Leverage" = output_plot_6()
997997
)
998-
obj
999998
})
1000999

10011000
decorated_output_q <- srv_decorate_teal_data(

R/tm_data_table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ srv_data_table <- function(id,
309309
teal::validate_has_data(df, min_nrow = 1L, msg = paste("data", dataname, "is empty"))
310310
qenv <- teal.code::eval_code(
311311
data(),
312-
'library("dplyr");library("DT")' # nolint: quotes.
312+
expression(library("dplyr"), library("DT"))
313313
)
314314
teal.code::eval_code(
315315
qenv,

R/tm_g_association.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ srv_tm_g_association <- function(id,
349349
teal.reporter::teal_card(obj),
350350
teal.reporter::teal_card("## Module's code")
351351
)
352-
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("ggmosaic")') # nolint: quotes.
352+
teal.code::eval_code(obj, expression(library("ggplot2"), library("dplyr"), library("ggmosaic")))
353353
})
354354
anl_merged_q <- reactive({
355355
req(anl_merged_input())

R/tm_g_distribution.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ srv_distribution <- function(id,
524524
)
525525

526526
qenv <- reactive(
527-
teal.code::eval_code(data(), 'library("ggplot2");library("dplyr")') # nolint: quotes.
527+
teal.code::eval_code(data(), expression(library("ggplot2"), library("dplyr")))
528528
)
529529

530530
anl_merged_q <- reactive({
@@ -665,7 +665,7 @@ srv_distribution <- function(id,
665665
"Group by variable must be `factor`, `character`, or `integer`"
666666
)
667667
)
668-
qenv <- teal.code::eval_code(qenv, 'library("forcats")') # nolint: quotes.
668+
qenv <- teal.code::eval_code(qenv, expression(library("forcats")))
669669
qenv <- teal.code::eval_code(
670670
qenv,
671671
substitute(
@@ -683,7 +683,7 @@ srv_distribution <- function(id,
683683
)
684684
)
685685

686-
qenv <- teal.code::eval_code(qenv, 'library("forcats")') # nolint: quotes.
686+
qenv <- teal.code::eval_code(qenv, expression(library("forcats")))
687687
qenv <- teal.code::eval_code(
688688
qenv,
689689
substitute(
@@ -893,7 +893,7 @@ srv_distribution <- function(id,
893893
}
894894

895895
if (length(t_dist) != 0 && main_type_var == "Density" && length(g_var) == 0 && length(s_var) == 0) {
896-
qenv <- teal.code::eval_code(qenv, 'library("ggpp")') # nolint: quotes.
896+
qenv <- teal.code::eval_code(qenv, expression(library("ggpp")))
897897
qenv <- teal.code::eval_code(
898898
qenv,
899899
substitute(
@@ -1039,7 +1039,7 @@ srv_distribution <- function(id,
10391039
)
10401040

10411041
if (length(t_dist) != 0 && length(g_var) == 0 && length(s_var) == 0) {
1042-
qenv <- teal.code::eval_code(qenv, 'library("ggpp")') # nolint: quotes.
1042+
qenv <- teal.code::eval_code(qenv, expression(library("ggpp")))
10431043
qenv <- teal.code::eval_code(
10441044
qenv,
10451045
substitute(
@@ -1235,7 +1235,7 @@ srv_distribution <- function(id,
12351235
qenv <- common_q()
12361236

12371237
if (length(s_var) == 0 && length(g_var) == 0) {
1238-
qenv <- teal.code::eval_code(qenv, 'library("generics")') # nolint: quotes.
1238+
qenv <- teal.code::eval_code(qenv, expression(library("generics")))
12391239
qenv <- teal.code::eval_code(
12401240
qenv,
12411241
substitute(
@@ -1249,7 +1249,7 @@ srv_distribution <- function(id,
12491249
)
12501250
)
12511251
} else {
1252-
qenv <- teal.code::eval_code(qenv, 'library("tidyr")') # nolint: quotes.
1252+
qenv <- teal.code::eval_code(qenv, expression(library("tidyr")))
12531253
qenv <- teal.code::eval_code(
12541254
qenv,
12551255
substitute(

R/tm_g_response.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ srv_g_response <- function(id,
390390
)
391391

392392
qenv <- reactive(
393-
teal.code::eval_code(data(), 'library("ggplot2");library("dplyr")') # nolint: quotes.
393+
teal.code::eval_code(data(), expression(library("ggplot2"), library("dplyr")))
394394
)
395395

396396
anl_merged_q <- reactive({

R/tm_g_scatterplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ srv_g_scatterplot <- function(id,
591591
teal.reporter::teal_card(obj),
592592
teal.reporter::teal_card("## Module's code")
593593
)
594-
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr")') # nolint: quotes.
594+
teal.code::eval_code(data(), expression(library("ggplot2"), library("dplyr")))
595595
})
596596

597597
anl_merged_q <- reactive({

R/tm_g_scatterplotmatrix.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ srv_g_scatterplotmatrix <- function(id,
334334
teal.reporter::teal_card(obj),
335335
teal.reporter::teal_card("## Module's code")
336336
)
337-
qenv <- teal.code::eval_code(obj, 'library("dplyr");library("lattice")') # nolint: quotes.
337+
qenv <- teal.code::eval_code(obj, expression(library("dplyr"),library("lattice")))
338338
teal.code::eval_code(qenv, as.expression(anl_merged_input()$expr))
339339
})
340340

@@ -371,7 +371,6 @@ srv_g_scatterplotmatrix <- function(id,
371371

372372
# check character columns. If any, then those are converted to factors
373373
check_char <- vapply(ANL[, cols_names], is.character, logical(1))
374-
qenv <- teal.code::eval_code(qenv, 'library("dplyr")') # nolint: quotes.
375374
if (any(check_char)) {
376375
qenv <- teal.code::eval_code(
377376
qenv,

R/tm_missing_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ srv_missing_data <- function(id,
529529
)
530530

531531
qenv <- teal.code::eval_code(obj, {
532-
'library("dplyr");library("ggplot2");library("tidyr");library("gridExtra")' # nolint: quotes.
532+
expression(library("dplyr"),library("ggplot2"),library("tidyr"),library("gridExtra"))
533533
})
534534

535535
qenv <- if (!is.null(selected_vars()) && length(selected_vars()) != ncol(anl)) {
@@ -1115,7 +1115,7 @@ srv_missing_data <- function(id,
11151115
qenv <- if (!is.null(group_var)) {
11161116
common_code_libraries_q <- teal.code::eval_code(
11171117
qenv,
1118-
'library("forcats");library("glue");' # nolint: quotes.
1118+
expression(library("forcats"), library("glue"))
11191119
)
11201120
teal.code::eval_code(
11211121
common_code_libraries_q,

R/tm_t_crosstable.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ srv_t_crosstable <- function(id, data, label, x, y, remove_zero_columns, basic_t
335335
teal.reporter::teal_card(obj),
336336
teal.reporter::teal_card("## Module's code")
337337
)
338-
teal.code::eval_code(obj, 'library("rtables");library("tern");library("dplyr")') # nolint: quotes.
338+
teal.code::eval_code(obj, expression(library("rtables"), library("tern"), library("dplyr")))
339339
})
340340
anl_merged_q <- reactive({
341341
req(anl_merged_input())

0 commit comments

Comments
 (0)