We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following the transformer vignette, I am trying to build a transformer module, which creates a selectInput with choices derived from the data.
selectInput
choices
library(teal) data <- within(teal_data(), { iris <- iris mtcars <- mtcars }) transformator_iris_scale <- teal_transform_module( label = "Scaling transformator for iris", ui = function(id) { ns <- NS(id) uiOutput(ns("scaled_columns_container")) }, server = function(id, data) { moduleServer(id, function(input, output, session) { ns <- session$ns scalable_columns <- names(Filter(is.numeric, isolate(data())[["iris"]])) output$scaled_columns_container <- renderUI({ selectInput( inputId = ns("scaled_columns"), label = "Columns to scale", choices = scalable_columns, selected = input$scaled_columns, multiple = TRUE ) }) reactive({ data() # no-op for simplicity }) }) } ) app <- init( data = data, modules = teal::example_module(transformators = list(transformator_iris_scale)) ) shinyApp(app$ui, app$server)
I used isolate(data()) in the module server function (not in a reactive and not in within) and I am not getting anything (no choices).
isolate(data())
reactive
within
Upon inspection,
Browse[1]> data() NULL
The transformer in question was used as the second transformation to iris. When I drop in to the first one with browser, I get this:
iris
browser
Browse[1]> data() Error:
which looks like a req error.
req
In order to get it to work I had to replace
scalable_columns <- names(Filter(is.numeric, isolate(data())[["iris"]]))
with
scalable_columns <- reactive({ names(Filter(is.numeric, data()[["iris"]])) })
which does work but it is something that should be mentioned in the vignette.
> packageVersion("teal") [1] '0.15.2.9117'
The text was updated successfully, but these errors were encountered:
4bd73cf
gogonzo
Successfully merging a pull request may close this issue.
What happened?
Following the transformer vignette, I am trying to build a transformer module, which creates a
selectInput
withchoices
derived from the data.code
I used
isolate(data())
in the module server function (not in areactive
and not inwithin
) and I am not getting anything (no choices).Upon inspection,
NOTE
The transformer in question was used as the second transformation to
iris
. When I drop in to the first one withbrowser
, I get this:which looks like a
req
error.WORKAROUND
In order to get it to work I had to replace
with
which does work but it is something that should be mentioned in the vignette.
sessionInfo()
Relevant log output
Code of Conduct
Contribution Guidelines
Security Policy
The text was updated successfully, but these errors were encountered: