issues with infoBox in Shiny Dashboard

Hello,
I have an issue with the use of infobox in my shiny dashboard, i get this error and don't know how to fix it: Error in tagAssert: Expected an object with class 'shiny.tag'
here is a part of my code:

    header = dashboardHeaderPlus(
        title = "Clients fragiles",
        titleWidth = 300
        
    ),
    skin = "red",
    sidebar = dashboardSidebar(
        width = 300,
        fileInput( inputId = "corresp" ,
                   label = "Fichiers Correspondants" ,
                   multiple = TRUE ,
                   accept =c( ".xlsx", ".xls" )) ,
        
        fileInput( inputId = "visit" ,
                   label = "Fichiers Visites" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls")  ) ,
        
        fileInput( inputId = "reclam" ,
                   label = "Fichiers Réclamations" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls") ) ,
        
        fileInput( inputId = "solli" ,
                   label = "Fichiers Sollicitations" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls") ) ,
        
        fileInput( inputId = "acc" ,
                   label = "Fichiers 100 % Accueil" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls")  ) ,
        
        fileInput( inputId = "deploie" ,
                   label = "Fichiers 100 % Déploiement" ,
                   multiple = TRUE ,
                   accept =c(".xlsx",".xls")) ,
        
        fileInput( inputId = "csa" ,
                   label = "Fichiers CSAT" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls") ), 
        
        fileInput( inputId = "cib" ,
                   label = "Fichiers Cibles au T-1" ,
                   multiple = TRUE ,
                   accept = c(".xlsx",".xls")  )
        
        # downloadBttn(
        #     outputId = "downloadtable",
        #     label="Télécharger la cible",
        #     style = "float",
        #     color = "default",
        #     size="sm")
        ),
    
   
    body = dashboardBody(
        
      fluidRow(

        box(flexdashboard::gaugeOutput("value1"),width=2,title="Clients fragiles", height = "200px"),
        infoBoxOutput("value2", width=2),
        infoBoxOutput("value3", width=2),
        infoBoxOutput("value4", width=2),
        infoBoxOutput("value5", width=2)
      ),


      fluidRow(

        gradientBox(
            title = "Etapes de traitement",
            width = 12,
            icon = "fa fa-th",
            gradientColor = "red",
            boxToolSize = "sm",
            closable = TRUE,
            footer= plotOutput("sortie")   )
        )
        
         )
)


       
        
        
     server <- function( input , output ) {
    
    # Augmenter la taille des téléchargements
    options( shiny.maxRequestSize = 900*1024^2 ) 
  
    
    # Background
    
    wk <- reactive({
      
      if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}
      
    
 dataset_n<- data.frame(table = c("Correspondant", "Visite","Réclamation","Sollicitation", "Accueil", "Déploiement", "Csat", "Cible T-1"),
                               volumetrie =c(nrow(correspondant), nrow(visite), nrow(reclamation), nrow(sollicitation), nrow(accueils), nrow(deploiements), nrow(csats), nrow(cibles) )) 
        
        dataset_n$table <- factor(dataset_n$table, ordered=T, levels=c("Correspondant", "Visite","Réclamation","Sollicitation", "Accueil", "Déploiement", "Csat", "Cible T-1"))
        

        combo <- list(workspace = workspace, dataset_n = dataset_n)
        combo
        
           })
        
        
          
             output$sortie <- renderPlot({
               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}
               
                 combo <-wk()
                 
                 dataset_n <- combo$dataset_n

               p <-  ggplot(dataset_n, aes(x=table, y=volumetrie))+
                  geom_col(fill="darkorange")+
                  scale_x_discrete("") +
                  scale_y_continuous("",label=number) +
                  geom_text(aes(label = number(volumetrie)), vjust = -0.5,size = 3.5)+
                  theme_minimal()

        return(p) } ) 

             output$value1 <-  flexdashboard::renderGauge({

               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}

               combo <- wk()

               workspace <- combo$workspace

               fragile <- workspace %>% count(`CLIENT FRAGILE CSAT ?`) %>% as.data.frame()

               fragile <- fragile %>%
                 arrange(desc(`CLIENT FRAGILE CSAT ?`)) %>%
                 mutate(prop=n/sum(n),
                        total=sum(n))

               gauge(fragile$prop, min = 0, max = 100, symbol = '%', label = paste("Clients fragiles"),gaugeSectors(
                 success = c(0, 30), warning = c(30, 50), danger = c(50, 100), colors = c("#16B84E", "#ED7F10","#FE1B00")
               ))

             })




             # output$value1 <- renderValueBox({
             #
             #     valueBox(
             #         paste("Clients fragiles": fragile$prop),
             #
             #         color = "red")
             # })
             #

             output$value2 <- renderInfoBox({

               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}

               combo <-wk()

               workspace <- combo$workspace

               recla <- combo %>% count(`Raison de fragilité`= str_detect(`Raison(s) fragilité`, regex("Réclamation", ignore_case = T))) %>% as.data.frame()

               recla <- recla %>% filter(`Raison de fragilité`==TRUE) %>% mutate(`Raison de fragilité`="Réclamation") %>% mutate(prop=n/sum(n))


               infoBox(
                 "Réclamation",
                 recla$prop ,
                 icon = icon("list"),
                 color = "green",
                 width=2)
             })



             output$value3 <- renderInfoBox({

               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}

               combo <-wk()

               workspace <- combo$workspace

               sat <- workspace %>% count(`Raison de fragilité`= str_detect(`Raison(s) fragilité`, regex("SAT", ignore_case = T))) %>% as.data.frame()

               sat <- sat %>% filter(`Raison de fragilité`==TRUE) %>% mutate(`Raison de fragilité`="SAT") %>% mutate(prop=n/sum(n))


               infoBox(
                 "Satisfaction",
                 sat$prop ,
                 icon = icon("list"),
                 color = "yellow",
                 width=2)
             })


             output$value4 <- renderInfoBox({

               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}

               combo <-wk()

               workspace <- combo$workspace


               vis <- workspace %>% count(`Raison de fragilité`= str_detect(`Raison(s) fragilité`, regex("Visite", ignore_case = T))) %>% as.data.frame()

               vis <- vis %>% filter(`Raison de fragilité`==TRUE) %>% mutate(`Raison de fragilité`="Visite") %>% mutate(prop=n/sum(n))


               infoBox(
                 "Visites",
                 vis$prop ,
                 icon = icon("list"),
                 color = "light-blue",
                 width=2)
             })

             output$value5 <- renderInfoBox({

               if(is.null(input$corresp ) |is.null(input$visit )| is.null(input$reclam ) | is.null(input$solli )|is.null(input$acc)|is.null(input$deploie)|is.null(input$csa)|is.null(input$cib) ){return ()}

               combo <-wk()

               workspace <- combo$workspace


               esc <- workspace %>% count(`Raison de fragilité`= str_detect(`Raison(s) fragilité`, regex("escalade", ignore_case = T))) %>% as.data.frame()

               esc <- esc %>% filter(`Raison de fragilité`==TRUE) %>% mutate(`Raison de fragilité`="Escalade") %>% mutate(prop=n/sum(n))


               infoBox(
                 "Escalade",
                 esc$prop ,
                 icon = icon("list"),
                 color = "orange", width=2)
             })
}
shinyApp(ui = ui, server = server)

Can anyone please help ?

thank's in advance

Hi,

Issues with Shiny code can stem from both the reactive Shiny code itself or the regular R code used in the functions. In order for us to help you with your question, please provide us a minimal reprocudible example (Reprex) where you provide a minimal (dummy) dataset and code that can recreate the issue. One we have that, we can go from there. For help on creating a Reprex, see this guide:

In your case, try to figure out which infobox it is that's causing the problem by first commenting out all the server code that generates the output for the boxes, then uncommenting them one by one until the issue appears. Then create a reprex with just that code

Good luck!
PJ

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.