From ba65965502146e8563cfd616704933458852bee3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 Dec 2023 19:05:47 +0530 Subject: [PATCH] filtering datanames for data.frame --- R/tm_data_table.R | 6 +++++- R/tm_missing_data.R | 3 +++ R/tm_variable_browser.R | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 96421f9a9..da9a0f446 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -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 diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 15e19cbcf..029262c26 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -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 diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index c0288ce9b..d1ac35333 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -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)