-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
What happened?
Problem
Example of tm_a_pca
using a character name for the dataset to extract the data does not behave the same and produces an error.
When inspecting the code, response[[i]]
variable processing assumes that it's not a delayed_data
object.
teal.modules.general/R/tm_a_pca.R
Lines 304 to 310 in 99d7f02
response[[i]]$select$multiple <- FALSE | |
response[[i]]$select$always_selected <- NULL | |
response[[i]]$select$selected <- NULL | |
all_cols <- teal.data::col_labels(isolate(data())[[response[[i]]$dataname]]) | |
ignore_cols <- unlist(teal.data::join_keys(isolate(data()))[[response[[i]]$dataname]]) | |
color_cols <- all_cols[!names(all_cols) %in% ignore_cols] | |
response[[i]]$select$choices <- choices_labeled(names(color_cols), color_cols) |
How to reproduce:
library(teal.module.general)
data <- within(teal_data(), {
require(nestcolor)
USArrests <- USArrests
})
datanames(data) <- "USArrests"
## Delayed data (with error)
teal::init(
data = data,
modules = teal.module.general::tm_a_pca(
dat = teal.transform::data_extract_spec(
dataname = "USArrests",
select = select_spec(
choices = teal.transform::variable_choices(
data = "USArrests",
c("Murder", "Assault", "UrbanPop", "Rape")
),
selected = c("Murder", "Assault"),
multiple = TRUE
)
)
)
) |> shiny::runApp()
Expected behavior
Same result using example for module (that uses variable_choices
with data itself instead of character)
# Non-delayed data (without error)
teal::init(
data = data,
modules = tm_a_pca(
dat = data_extract_spec(
dataname = "USArrests",
select = select_spec(
choices = variable_choices(
data = data[["USArrests"]],
c("Murder", "Assault", "UrbanPop", "Rape")
),
selected = c("Murder", "Assault"),
multiple = TRUE
)
)
)
) |> shiny::runApp()
sessionInfo()
No response
Relevant log output
No response
Code of Conduct
- I agree to follow this project's Code of Conduct.
Contribution Guidelines
- I agree to follow this project's Contribution Guidelines.
Security Policy
- I agree to follow this project's Security Policy.