Using multiple tables for creating a single formattable table

31 views Asked by At

I am new to Shiny and R, i am trying to create a table using Formattable. I have two tables, one which contains the values and other which contains the significance of those values. I would like to use both the tables for creating a new table, which will have values from the former table and corresponding to it we will have a symbol (arrow) to point out whether the value is significant or not (by using values from the significance table, -ve value implies down arrow).

I have written a sample code for showing the arrows. Here i have used one table, but i would like to use two tables, one for value and other for arrow, but both value and arrow should come in a single cell for the resulting solution table.

table %>%
formattable(
    lapply(table,function(x){
      if(is.numeric(x)){
        x <- paddedcolor_bar_custom(max_of_table = table_max_value)
      } else {
        x <- nocolor_bar_custom()
      }
    })
  )

Padded custom bar contains the following code

formattable::formatter("span", 
                        style = x ~ style(font.weight = "bold", 
                                          color = ifelse(x > 0, "grey", ifelse(x < 0, "grey", "black"))), 
                                x ~ icontext(ifelse(x>=0, "arrow-up", "arrow-down"), x))
0

There are 0 answers