Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
31b7b1b
use restoreInput in updates: tm_g_distribution
Mar 13, 2024
f2787ef
use restoreInput in updates: tm_a_regression
Mar 13, 2024
0bcd71f
use restoreInput in updates: tm_missing_data
Mar 13, 2024
0ba693a
use restoreInput in updates: tm_outliers
Mar 13, 2024
408dbda
Merge branch 'main' into 898_save_app_state3@main
Mar 15, 2024
d4a7836
all tabsetPanel have id
Mar 15, 2024
1249e72
[skip style] [skip vbump] Restyle files
github-actions[bot] Mar 15, 2024
5c922f9
trigger
Mar 15, 2024
807ee6b
Merge branch 'main' into 898_save_app_state3@main
chlebowa Mar 18, 2024
6f393e2
Merge branch 'main' into 898_save_app_state3@main
chlebowa Mar 20, 2024
efea9d5
simplify logic in tm_g_distribution
Mar 21, 2024
63b8d84
modify dist params logic to allow bookmarking
Mar 21, 2024
605a256
introduce teal_bookmarkable attribute in modules
Mar 25, 2024
ebf6fb7
break lines
Mar 25, 2024
245f0c6
clean up
Mar 25, 2024
b6da993
module bookmarkable: tm_t_frontpage
Mar 25, 2024
f1600ef
module bookmarkable: tm_g_bivariate
Mar 25, 2024
cde83e2
module bookmarkable: tm_variable_browser
Mar 25, 2024
ea841f8
module bookmarkable: tm_file_viewer
Mar 25, 2024
303c787
module bookmarkable: tm_g_association
Mar 25, 2024
717595b
module bookmarkable: tm_g_response
Mar 25, 2024
f5c1c2d
module bookmarkable: tm_g_scatterplot
Mar 25, 2024
5383d5c
module bookmarkable: tm_g_scatterplotmatrix
Mar 25, 2024
4af39e3
module bookmarkable: tm_t_crosstable
Mar 25, 2024
61cef67
[skip style] [skip vbump] Restyle files
github-actions[bot] Mar 25, 2024
b191ed1
fix erroneous bookmarkable flags
Mar 25, 2024
e4fbec7
Merge branch '898_save_app_state3@main' of github.com:insightsenginee…
Mar 25, 2024
5473cf4
module bookmarkable: tm_outliers
Mar 25, 2024
76daa5d
fix linter
Mar 25, 2024
41dba68
remove erroneous bookmarkable flag
Mar 25, 2024
3292ba5
module bookmarkable: tm_missing_data
Mar 25, 2024
d866adc
fix typo
Mar 25, 2024
43011fc
module bookmarkable: tm_a_pca
Mar 25, 2024
4b17fd1
fix error
gogonzo Mar 26, 2024
9623d52
fixes
gogonzo Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL,
object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9A-Z_]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$"))
object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9A-Z_]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$")),
indentation_linter = NULL
)
10 changes: 8 additions & 2 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ tm_a_pca <- function(label = "Principal Component Analysis",

data_extract_list <- list(dat = dat)

module(
ans <- module(
label = label,
server = srv_a_pca,
ui = ui_a_pca,
Expand All @@ -176,6 +176,8 @@ tm_a_pca <- function(label = "Principal Component Analysis",
),
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
attr(ans, "teal_bookmarkable") <- FALSE
ans
}

# UI function for the PCA module
Expand Down Expand Up @@ -753,7 +755,11 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
dev_labs <- list(color = varname_w_label(resp_col, ANL))

scales_biplot <-
if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint: line_length.
if (
is.character(response) ||
is.factor(response) ||
(is.numeric(response) && length(unique(response)) <= 6)
) {
qenv <- teal.code::eval_code(
qenv,
quote(pca_rot$response <- as.factor(response))
Expand Down
10 changes: 7 additions & 3 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ tm_a_regression <- function(label = "Regression Analysis",
response = response
)

module(
ans <- module(
label = label,
server = srv_a_regression,
ui = ui_a_regression,
Expand All @@ -241,6 +241,8 @@ tm_a_regression <- function(label = "Regression Analysis",
),
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
attr(ans, "teal_bookmarkable") <- FALSE
ans
}

# UI function for the regression module
Expand Down Expand Up @@ -370,6 +372,8 @@ srv_a_regression <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
ns <- session$ns

rule_rvr1 <- function(value) {
if (isTRUE(input$plot_type == "Response vs Regressor")) {
if (length(value) > 1L) {
Expand Down Expand Up @@ -472,7 +476,7 @@ srv_a_regression <- function(id,
session = session,
inputId = "label_var",
choices = opts,
selected = selected
selected = restoreInput(ns("label_var"), selected)
)

data <- fortify(stats::lm(form, data = ANL))
Expand All @@ -484,7 +488,7 @@ srv_a_regression <- function(id,
inputId = "outlier",
min = 1,
max = max_outlier,
value = if (cur_outlier < max_outlier) cur_outlier else max_outlier * .9
value = restoreInput(ns("outlier"), if (cur_outlier < max_outlier) cur_outlier else max_outlier * .9)
)
}

Expand Down
73 changes: 39 additions & 34 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ tm_data_table <- function(label = "Data Table",
checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE)
# End of assertions

module(
ans <- module(
label,
server = srv_page_data_table,
ui = ui_page_data_table,
Expand All @@ -133,6 +133,8 @@ tm_data_table <- function(label = "Data Table",
post_output = post_output
)
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
}

# UI page module
Expand Down Expand Up @@ -196,41 +198,44 @@ srv_page_data_table <- function(id,
output$dataset_table <- renderUI({
do.call(
tabsetPanel,
lapply(
datanames,
function(x) {
dataset <- isolate(data()[[x]])
choices <- names(dataset)
labels <- vapply(
dataset,
function(x) ifelse(is.null(attr(x, "label")), "", attr(x, "label")),
character(1)
)
names(choices) <- ifelse(
is.na(labels) | labels == "",
choices,
paste(choices, labels, sep = ": ")
)
variables_selected <- if (!is.null(variables_selected[[x]])) {
variables_selected[[x]]
} else {
utils::head(choices)
}
tabPanel(
title = x,
column(
width = 12,
tags$div(
class = "mt-4",
ui_data_table(
id = session$ns(x),
choices = choices,
selected = variables_selected
c(
list(id = session$ns("dataname_tab")),
lapply(
datanames,
function(x) {
dataset <- isolate(data()[[x]])
choices <- names(dataset)
labels <- vapply(
dataset,
function(x) ifelse(is.null(attr(x, "label")), "", attr(x, "label")),
character(1)
)
names(choices) <- ifelse(
is.na(labels) | labels == "",
choices,
paste(choices, labels, sep = ": ")
)
variables_selected <- if (!is.null(variables_selected[[x]])) {
variables_selected[[x]]
} else {
utils::head(choices)
}
tabPanel(
title = x,
column(
width = 12,
div(
class = "mt-4",
ui_data_table(
id = session$ns(x),
choices = choices,
selected = variables_selected
)
)
)
)
)
}
}
)
)
)
})
Expand Down Expand Up @@ -296,7 +301,7 @@ srv_data_table <- function(id,
iv <- shinyvalidate::InputValidator$new()
iv$add_rule("variables", shinyvalidate::sv_required("Please select valid variable names"))
iv$add_rule("variables", shinyvalidate::sv_in_set(
set = names(data()[[dataname]]), message_fmt = "Not all selected variables exist in the data"
set = names(isolate(data())[[dataname]]), message_fmt = "Not all selected variables exist in the data"
))
iv$enable()

Expand Down
4 changes: 3 additions & 1 deletion R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ tm_file_viewer <- function(label = "File Viewer Module",
# Make UI args
args <- as.list(environment())

module(
ans <- module(
label = label,
server = srv_viewer,
server_args = list(input_path = input_path),
ui = ui_viewer,
ui_args = args,
datanames = NULL
)
attr(ans, "teal_bookmarkable") <- FALSE
ans
}

# UI function for the file viewer module
Expand Down
6 changes: 5 additions & 1 deletion R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,16 @@ tm_front_page <- function(label = "Front page",
# Make UI args
args <- as.list(environment())

module(
ans <- module(
label = label,
server = srv_front_page,
ui = ui_front_page,
ui_args = args,
server_args = list(tables = tables, show_metadata = show_metadata),
datanames = if (show_metadata) "all" else NULL
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
}

# UI function for the front page module
Expand Down Expand Up @@ -137,6 +139,8 @@ srv_front_page <- function(id, data, tables, show_metadata) {
moduleServer(id, function(input, output, session) {
ns <- session$ns

setBookmarkExclude("metadata_button")

lapply(seq_along(tables), function(idx) {
output[[paste0("table_", idx)]] <- renderTable(
tables[[idx]],
Expand Down
4 changes: 3 additions & 1 deletion R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ tm_g_association <- function(label = "Association",
vars = vars
)

module(
ans <- module(
label = label,
server = srv_tm_g_association,
ui = ui_tm_g_association,
Expand All @@ -188,6 +188,8 @@ tm_g_association <- function(label = "Association",
),
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
}

# UI function for the association module
Expand Down
8 changes: 6 additions & 2 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
size = size
)

module(
ans <- module(
label = label,
server = srv_g_bivariate,
ui = ui_g_bivariate,
Expand All @@ -299,6 +299,8 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
),
datanames = teal.transform::get_extract_datanames(data_extract_list)
)
attr(ans, "teal_bookmarkable") <- TRUE
ans
}

# UI function for the bivariate module
Expand Down Expand Up @@ -463,6 +465,8 @@ srv_g_bivariate <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
ns <- session$ns

data_extract <- list(
x = x, y = y, row_facet = row_facet, col_facet = col_facet,
color = color, fill = fill, size = size
Expand Down Expand Up @@ -586,7 +590,7 @@ srv_g_bivariate <- function(id,
}
} else {
shinyjs::hide("add_lines")
updateCheckboxInput(session, "add_lines", value = FALSE)
updateCheckboxInput(session, "add_lines", value = restoreInput(ns("add_lines"), FALSE))
shinyjs::hide("alpha")
shinyjs::hide("fixed_size")
shinyjs::hide("size_settings")
Expand Down
Loading