RHandsontable 不正确的输入转换,当使用格式时

RHandsontable Incorrect Input Conversion, when format is used

我遇到了 RHandsontable(版本:0.3.6)的特殊问题。我面临的问题与 UI 的输入转换有关。输入数字输入 (x) 时,它们将被正确存储。但是,当输入百分比输入 (x%) 时,除了 Zeroeth 百分比(0%、0.0%、0.00% 等)之外的所有值都被正确存储。从 excel 下载可见,Zeroeth 百分比已转换为 NULL 值。

Reproducible Example Snapshot

附上观察到的行为的可重现示例。

library(shiny)
library(openxlsx)
library(rhandsontable)

ui <- fluidPage(
      br(),
      rHandsontableOutput("table"),
      br(),
      downloadButton("download","Download"))

server <- function(input, output, session) {

   output$table <- renderRHandsontable({

   df <- data.frame("Growth" = c(0.1,0.02,0.06,0.24,0.08))

   rhandsontable(df, rowHeaders = NULL,colHeaders = c("Growth")) %>%
   hot_col(c("Growth"), format = "0.0%") %>%
   hot_validate_numeric(cols = c(1),min = 0.00, max = 1.00)

   })


   output$download <- downloadHandler(
   filename = function() {
   paste('Report.xlsx')
   },

   content <- function(file) {
   write.xlsx(hot_to_r(input$table),file)
   })

}

shinyApp(ui, server)

需要在 UI 中更改输入,而不是代码本身。您可以尝试输入 0%( 而不是 0)作为 UI 中的输入,它会在 excel 提取中产生 NULL 值,其中“0% "、"0.0%" 等被插入。您可以通过下载 excel 摘录来验证我的发现。这是与软件包相关的问题还是与此代码相关?如果以后任何调试指针表示赞赏。

最新版本的包 rhandsontable 已解决此问题,有关详细信息,请访问此 github link。

https://github.com/jrowen/rhandsontable/issues/270