I am trying to select a dataset from a selectizeInput. And at the same time, I am trying to visulize it with esquisseUI. But I could not send my selected data to esquisseUI. I have used callModule.
Here is my code:
library(bs4Dash)
library(shiny)
library(esquisse)
ui <- bs4DashPage(
enable_preloader = TRUE,
old_school = FALSE,
sidebar_collapsed = TRUE,
controlbar_collapsed = TRUE,
navbar = bs4DashNavbar(
skin = "dark",
sideBarIcon = "bars",
controlbarIcon = "th"
),
sidebar = bs4DashSidebar(
skin = "dark",
title = "DataVisABI",
brandColor = "purple",
text = "Welcome App!",
bs4SidebarMenu(
bs4SidebarHeader("Main Menu"),
bs4SidebarMenuItem(
"Input Data",
tabName = "inputData",
icon = "sliders"
),
bs4SidebarMenuItem(
"Automated Visualization",
tabName = "autov",
icon = "id-card"
),
bs4SidebarMenuItem(
"Manual Visualization",
tabName = "manualv",
icon = "id-card"
)
)
),
body = bs4DashBody(
bs4TabItems(
bs4TabItem(
tabName = "inputData",
fluidRow(
column(
width = 4,
bs4Card(
inputId = "dataImport",
title = "Upload Dataset",
solidHeader = FALSE,
headerBorder = TRUE,
width = 12,
height = 600,
collapsible = TRUE,
closable = FALSE,
status = "dark",
selectInput(
'dataset',
label = "Choose Dataset",
choices = names(datasets),
selected = "iris",
width = "500px"
),
br(),
fileInput('fileIn', label = 'Upload Data', width = "500px") %>% disabled(),
br(),
actionBttn('btn_viewData', label = 'View Data', size = "md", color = "primary", block = TRUE, style = "fill")
)
),
column(
width = 4,
bs4Card(
inputId = "dataImport",
title = "Target Variable",
status = "warning",
solidHeader = FALSE,
headerBorder = TRUE,
width = 12,
height = 600,
collapsible = TRUE,
closable = FALSE,
#status = "dark",
#helpText('Select target variable'),
selectizeInput('yvar', label='Select target variable', choices = character(0), width = "500px"),
helpText(HTML(paste('Data Type:', textOutput('Ytype')))),
bsTooltip(id = "lbl_yvar", title = "Target Vairable", placement = "right", trigger = "hover"),
br(),
plotOutput('Yplot',height=260),
conditionalPanel("output.Ytype == 'numeric'|output.Ytype == 'integer'",
checkboxInput('chk_logY',label = 'log transform', width = "500px")
),
verbatimTextOutput('Ystats')
)
),
column(
width = 4,
bs4Card(
inputId = "dataImport",
title = "Input Variables",
status = "warning",
solidHeader = FALSE,
headerBorder = TRUE,
width = 12,
height = 600,
collapsible = TRUE,
closable = FALSE,
#status = "dark",
selectizeInput('xvar',label="Input Variables" , choices = character(0),multiple = T, width = "500px"),
bsTooltip(id = "lbl_xvar", title = "Try and predict Y as function of these variables",
placement = "right", trigger = "hover")
)
),
bsModal('data', title = 'Dataset', trigger = 'btn_viewData', size = 'large', dataTableOutput('rawdata'))
)
),
#bs4TabItem(tabName = "autovis", bs4Card(inputId = "xyz")),
bs4TabItem(
tabName = "manualv",
esquisserUI(
id = "esquisse",
header = FALSE,
choose_data = FALSE
)
)
)
)
)
server <- function(input, output, session){
rawdata <- reactive({
datasets[[input$dataset]]
})
esquisse_res <- callModule(
module = esquisserServer,
id = "esquisse",
data = rawdata
)
}
shinyApp(ui, server)
I have faced with errors like "Error in .getReactiveEnvironment()$currentContext". Can anybody help me where I must change or add somthing new?
Thanks,
Murat