I am trying to create a table using rhandsontable with several rows of merged cells (different cells in each row).
I am trying to achieve merging of the indicated cells in the screenshot below ...
I am able to successfully merge the first set of cells (row 11) but subsequent merges using a "list of lists" to specify the cells doesn't work. I have tried every permutation of the "list of lists" syntax that I can think of;
a reprex of the example is here ...
library(shiny)
library(rhandsontable)
## Create the data set
DF = data.frame((Cycle = 1:13),
`A` = as.numeric(""),
`B` = as.numeric(""),
`C` = as.numeric(""),
`D` = as.numeric(""))
DF[11,1] = "Total"
DF[12,1] = ""
DF[13,1] = "Loss"
server <- shinyServer(function(input, output, session) {
output$hotTable <- renderRHandsontable({rhandsontable(DF,
width = 1500, height = 350, rowHeaders = FALSE) %>%
hot_cols(colWidths = c(100, 150, 150, 150, 150)) %>%
hot_col(c(1,3:5), readOnly = TRUE) %>%
hot_col(col = c(1:5), halign = "htCenter") %>%
hot_col(col = c(2:4), format = "0.0000") %>%
hot_col(col = 5, format = 0000) %>%
hot_table(mergeCells = list(list(row = 10, col = 2, rowspan = 1, colspan = 3),
list(row = 11, col = 1, rowspan = 1, colspan = 5),
list(row = 12, col = 3, rowspan = 1, colspan = 3)))})
})
ui <- basicPage(mainPanel(rHandsontableOutput("hotTable")))
shinyApp(ui, server)