Pessoal,
My idea is to create multiple elements that have radioGroupButtons
and plotlyOutput
in a module
file. To avoid repetitions I created a function like this bellow:
A minha ideia é criar na ui do shiny conjuntos de radioGroupButtons
e plotlyOutput
. Eu estou usando modulos e aí esta ficando complicado.
Abaixo é a função de radioGroupButtons
e plotlyOutput
que criei:
tabpanel_content <- function(radio_id, plotly_id){
div(
id = "div_1",
style = "",
div(
class = "inputs ",
style = "width: 100%",
radioGroupButtons(
inputId = NS(radio_id),
label = "Radio",
choices = c("Input_1","Input_2"),
status = "success"
)
),
div(plotlyOutput(outputId = NS(plotly_id), height = 200,width = "auto"))
)
}
Em seguida colo essa funcao no modulo:
mod_1_UI <- function(id) {
ns <- NS(id)
tagList(
tabsetPanel(
tabPanel(
strong("TabPanel - Title"),
tabpanel_content(radio_id = 'radio_input',plotly_id = 'plotly_chart_1')
)))
}
mod_1_Server <- function(id) {
moduleServer(
id,
function(input, output, session) {
}
)
}
E depois puxo no app do Shiny:
library(shiny)
library(shinyWidgets)
library(plotly)
source(file = 'module_1.R')
source(file = 'input_functions_1.R')
ui <- fluidPage(
mod_1_UI("mod_1")
)
server <- function(input, output, session) {
mod_1_Server("mod_1")
}
shinyApp(ui, server)
Mas tenho o seguinte erro: cannot coerce type ‘closure’ to vector of type ‘character’
Eu tenho a impressão que se trata de uma mudança básica. Mas ja fiz de tudo por aqui.
Alguma ajuda?