How do I avoid "object not found" error?

22 views
Skip to first unread message

Mrinmay Kalita

unread,
Sep 29, 2022, 3:12:10 AM9/29/22
to Shiny - Web Framework for R
Hello,

When I run this code, why does it say "ctrl object not found". This is a part of the file histogram.R

> output$plotHistogramsUI <- renderUI({
>   req(dataCache$featureNames)
>  
>   allColumns <- union(dataCache$featureNames, dataCache$predTargetNames)
>  
>   ctrl <- list(fluidRow(column(6, numericInput('histPlotNumFig', 'Number of plots', 1, min = 1)),
>                         column(6, numericInput('histPlotNumFigPerRow', 'Plots per row', 3, min = 1))))
>  
>   #ctrl <- append(ctrl, list(selectInput('plotHistograms', label = 'Feature',
>   #                         multiple = T, choices = allColumns, selected = NULL)))
>  
>   dF <- dataCache$dataFrame
>
>   facCols <- names(dF)[sapply(dF, is.factor)]
>  
>   if (length(facCols) > 0) {
>     ctrl <- append(ctrl, list(hr(), selectizeInput('histPartitionBy', label = 'Partition by',
>                                                    multiple = T, choices = facCols,
>                                                    options = list('plugins' = list('remove_button'))),
>                               selectInput('histVisMode', 'Visualization', choices = c('overlay', 'stacked', 'side by side')), hr()))
>   }
>   return (ctrl)
> })
>
> # create the UI with the options for the histograms
> output$plotHisOptUI <- renderUI({
>   req(input$histPlotNumFig, input$histPlotNumFig, input$histPartitionBy)
>  
>   dF <- dataCache$dataFrame
>   for (i in 1:input$histPlotNumFig) {
>     # reuse existing values if any
>     isolate({
>       if (is.null(input[[paste0('histPlotFeatures', i)]])) {
>         selected <- NULL
>       } else {
>         selected <- input[[paste0('histPlotFeatures', i)]]
>       }
>     })
>    
>     numColumns <- dataCache$dataCols[sapply(dataCache$dataFrame[, dataCache$dataCols, drop = F], is.numeric)]
>     ctrl <- append(ctrl, list(selectizeInput(paste0('histPlotFeatures', i), label = paste0('Feature(s) - Plot ', i),
>                                              multiple = T, choices = numColumns, selected = selected)))
>   }
>   return (ctrl)
> })

Part of ui.R is -

> navbarMenu('Exploratory analysis',
>                           tabPanel('Histograms',
>                                    sidebarLayout(
>                                        sidebarPanel(
>                                            uiOutput('plotHistogramsUI'),
>                                            uiOutput('plotHisOptUI'),
>                                            uiOutput('plotHisOptUI1'),
>                                            width = 3),
>                                        mainPanel(
>                                            jqui_resizable(plotlyOutput('histPlt', width = '100%', height = '800px')),
>                                            br(), br(),
>                                            uiOutput('dataFiltersHistogram'),
>                                            br(), br(),
>                                            width = 9)
>                                    )),

Regards
Reply all
Reply to author
Forward
0 new messages