Skip to content

Commit

Permalink
filtering datanames for data.frame
Browse files Browse the repository at this point in the history
  • Loading branch information
kartikeyakirar committed Dec 19, 2023
1 parent 975d064 commit ba65965
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ srv_page_data_table <- function(id,
if_filtered <- reactive(as.logical(input$if_filtered))
if_distinct <- reactive(as.logical(input$if_distinct))

datanames <- teal.data::datanames(isolate(data()))
datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)

if (!identical(datasets_selected, character(0))) {
checkmate::assert_subset(datasets_selected, datanames)
datanames <- datasets_selected
Expand Down
3 changes: 3 additions & 0 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
plot_height, plot_width, ggplot2_args, ggtheme) {
moduleServer(id, function(input, output, session) {
datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)
if_subject_plot <- length(parent_dataname) > 0 && parent_dataname %in% datanames
ns <- session$ns

Expand Down
3 changes: 3 additions & 0 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ srv_variable_browser <- function(id,
.unique_records_default_as_factor <- 6 # nolint

datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
}, datanames)

checkmate::assert_character(datasets_selected)
checkmate::assert_subset(datasets_selected, datanames)
Expand Down

0 comments on commit ba65965

Please sign in to comment.