Kable and Highcharter under 1 plot

Hi all,

i am stuck with the problem here. I have 2 tables like shown below. I have kable function from 1 table and highcharter from another table. Now I am trying to make it interactive. Let me explain the scenario

This is table 1 called Past Maintainence (I have Mill-A and Mill-B data)

Past_Maintainence
    Mill Electrical Maintainence done Instrumentation Maintainence done Mechanical Maintainence done Performance
1 Mill-A                   2019-09-24                        2019-09-25                   2019-09-26         0.5
2 Mill-B                   2019-09-25                        2019-09-26                   2019-09-24         0.6

This is table 2 called Mill-A (I have other information about Mill-A, similarly I will have another table called Mill-B but not shown here)

`Mill-A`
  air_flow max_air min_air stabality_min_coal explosion_limit min_air_flowfall_out_limt max_coal_flow normal_coal_flow
1        5    14.2     7.6               46.5              25                     113.8            93            84.12
2       10    28.4    15.2               46.5              50                     113.8            93            84.12
  max_air_flow_erosion_limit fan_power
1                      162.5       256
2                      162.5       251

Now With respect to Mill-A Can I have both Kable function and highchart under 1 plot? i have tried the solve this problem with below code. But not working

---
title: "Untitled"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
    theme: cosmo
---

```{r setup, include=FALSE}
library(flexdashboard)
library(readxl)
library(tidyverse)
library(formattable)
library(highcharter)
library(reshape)
library(shiny)
library(knitr)
library(kableExtra)
```


```{r}
Past_Maintainence <- structure(list(Mill = c("Mill-A", "Mill-B"), `Electrical Maintainence done` = structure(c(1569283200, 
1569369600), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
    `Instrumentation Maintainence done` = structure(c(1569369600, 
    1569456000), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
    `Mechanical Maintainence done` = structure(c(1569456000, 
    1569283200), class = c("POSIXct", "POSIXt"), tzone = "UTC"), 
    Performance = c(0.5, 0.6)), row.names = 1:2, class = "data.frame")
`Mill-A` <- structure(list(air_flow = c(5, 10), max_air = c(14.2, 28.4), 
    min_air = c(7.6, 15.2), stabality_min_coal = c(46.5, 46.5
    ), explosion_limit = c(25, 50), min_air_flowfall_out_limt = c(113.8, 
    113.8), max_coal_flow = c(93, 93), normal_coal_flow = c(84.12, 
    84.12), max_air_flow_erosion_limit = c(162.5, 162.5), fan_power = c(256, 
    251)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", 
"data.frame"))
```

Summary
=================

Inputs {.sidebar}
-----------------------------------------------------------------------

```{r}
    selectInput("Mill1","Equipment",choices = c("All","Mill-A","Mill-B"),selected = "All",multiple = TRUE)
```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Performance {data-width=10}

```{r}
output$combined_plot1 <- renderText({
  req(input$Mill1)
  table_data <- Past_Maintainence
  if (input$Mill1 != "All"){
    table_data <- Past_Maintainence %>% filter(Mill %in% input$Mill1)
  }
  table_data %>% mutate(Performance = color_bar("lightgreen")(Performance)) %>% select(everything()) %>% kable(escape = F,caption = "Title") %>% kable_styling("hover", full_width = F)
})
htmlOutput("combined_plot1")

output$combined_plot <- renderHighchart({
  req(input$Mill1)
  if (input$Mill1 != "All"){
    plot_data <- input$Mill1
    design_melt <- subset(plot_data, select = -c(max_coal_flow, normal_coal_flow))
    design_melt <- as.data.frame(design_melt)
    melted <- melt(design_melt, id='air_flow')
  }
  hc_marker <- highchart()%>%
  hc_add_series(melted, "line", hcaes(x = value, y = air_flow, group = variable))%>%
  hc_add_series(`Mill-A`, "line", hcaes(x = air_flow, y = max_coal_flow), name = "max_coal_flow")%>%
  hc_add_series(`Mill-A`, "line", hcaes(x = air_flow, y = normal_coal_flow), name = "normal_coal_flow")%>%
  hc_add_series(`Mill-A`, "line", hcaes(x = air_flow, y = stabality_min_coal), name = "stabality_min_coal")%>%     
  hc_xAxis(min = 70, max = 250)%>%hc_yAxis(min = 15, max = 140)
  print(hc_marker)
})

highchartOutput("combined_plot")
```

Below is what I am expecting (for reference). Like when I select Mill-A, Both kable and highcharter for Mill-A should be displayed. When I select Mill-B, only kable should appear since I do not have Mill-B table here

Please guide

This post was flagged by the community and is temporarily hidden.