-
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
Description
In tm_g_association, when a selected categorical variable is a factor (not character), the app crashes.
error message
Listening on http://127.0.0.1:6444
[INFO] 2024-02-19 15:28:58.7853 pid:71573 token:[29b46c16] teal Initializing reporter_previewer_module
Warning: Error in match.arg: 'arg' must be of length 1
143: stop
142: match.arg
141: bivariate_ggplot_call [/home/users/chlebowa/NEST/teal.modules.general/R/tm_g_bivariate.R#750]
140: bivariate_plot_call [/home/users/chlebowa/NEST/teal.modules.general/R/tm_g_bivariate.R#688]
139: <reactive> [/home/users/chlebowa/NEST/teal.modules.general/R/tm_g_association.R#308]
123: output_q
122: <reactive> [/home/users/chlebowa/NEST/teal.modules.general/R/tm_g_association.R#425]
106: plot_r
97: renderUI [/home/users/chlebowa/NEST/teal.widgets/R/plot_with_settings.R#412]
96: func
83: renderFunc
82: output$teal-main_ui-root-association-module-myplot-plot_out_main
1: runApp
Warning: Error in match.arg: 'arg' must be of length 1
102: <Anonymous>
101: stop
100: output_q
97: renderText [/home/users/chlebowa/NEST/teal.modules.general/R/tm_g_association.R#436]
96: func
83: renderFunc
82: output$teal-main_ui-root-association-module-title
1: runApp
Warning: Error in match.arg: 'arg' must be of length 1
1: runApp
this app fails:
# general data exapmle
library(teal.modules.general)
library(teal.widgets)
data <- teal_data()
data <- within(data, {
library(nestcolor)
CO2 <- as.data.frame(CO2)
})
datanames(data) <- c("CO2")
app <- init(
data = data,
modules = modules(
tm_g_association(
ref = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
selected = "Plant",
fixed = FALSE
)
),
vars = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variables:",
choices = variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
selected = "Treatment",
multiple = TRUE,
fixed = FALSE
)
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Association Module")
)
)
)
)
runApp(app, launch.browser = TRUE)
this app works
# general data exapmle
library(teal.modules.general)
library(teal.widgets)
data <- teal_data()
data <- within(data, {
library(nestcolor)
CO2 <- as.data.frame(CO2)
factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L))))
CO2[factors] <- lapply(CO2[factors], as.character)
})
datanames(data) <- c("CO2")
app <- init(
data = data,
modules = modules(
tm_g_association(
ref = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
selected = "Plant",
fixed = FALSE
)
),
vars = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variables:",
choices = variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")),
selected = "Treatment",
multiple = TRUE,
fixed = FALSE
)
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Association Module")
)
)
)
)
runApp(app, launch.browser = TRUE)