Getting kableExtra popover to work on Shiny app

I have written a small shiny app that displays drug doses as tables. I used kable and kableExtra for formatting the tables and would like to add some warning for a couple of the cells. I came across thishttps://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_html.html#popover_message for kable but as I don't have any prior experience with HTML, I am not sure how to implement it.

My code looks something like this:

output$broncho.Kable <- renderText({
   
   table.broncho <- broncho.calc()
   
   st_dil_pop <- c("or 0.9% Sodium Chloride", "or 0.9% Sodium Chloride")
   
   dose_load_pop <- c("Omit loading if adequate level on oral theophylline. Max 500 mg", 
                      "Maximum loading dose 250 micrograms")
   
   table.broncho$st_dilution <- cell_spec(table.broncho$st_dilution,
     popover = spec_popover(
       content = st_dil_pop,
       title = NULL,
       position = "right",
       trigger = "hover"
     )
   )
   
   table.broncho <- table.broncho %>%
     select("Drug" = drug,
            "Formulation" = formulation,
            "Standard Dilution" = st_dilution,
            "Loading Dose" = dose_load,
            "Maintenance Dose" = dose_infusion,
            "Dose" = LD_dose,
            "Volume" = LD_vol,
            "Rate" = LD_rate,
            "Duration" = duration,
            "Maintenance" = maintenance_rate)
   
   kable(table.broncho, "html", escape = F) %>% 
     kable_styling("striped", full_width = T, font_size = 14) %>% 
     row_spec(1:nrow(table.broncho), color = "black", background = "white") %>%
     column_spec(6:8, background = mod) %>% 
     column_spec(1, bold = T, width = "10em")
   
 })

There is a mention of enabling popover module for it to work, but how do I do this within the context of a shinyapp?

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