闪亮:格式化存储为reactValue

时间:2018-10-19 02:49:51

标签: r datatable shiny format

我一直在开发一个闪亮的应用程序,该应用程序将data.table::data.table对象存储为reactiveValues元素。当我在renderDataTable函数中调用此元素并尝试将某些列设置为货币格式时,出现一条错误消息:

"You specified the columns: PY_ROT1, but the column names of the data are"
 96: stop
  95: name2int
  94: appendFormatter
  93: formatColumns
  92: formatCurrency
  91: function_list[[k]]
  89: freduce
  88: _fseq
  87: eval
  86: eval
  84: %>%
  83: exprFunc [C:\Users\OneDrive\Documents\shiny\test3/server.R#67]
  82: widgetFunc
  81: func
  80: origRenderFunc
  79: renderFunc
  78: origRenderFunc
  77: output$dmatrix
   1: runApp

我已经尝试过在此网站上发布的一些想法,但没有成功。我将不胜感激。代码如下:

      rv <- reactiveValues()

      source("./code/dmatrix_shiny.R")  
      observeEvent(input$calcmat, { 
        withBusyIndicatorServer("calcmat", {
        Sys.sleep(1)
        inFile <- input$file1
        if(is.null(inFile)) return(NULL)
        dt <- loadWorkbook(inFile$datapath)
        rv$mat <- dmatrix(dt, input$val_year) # this returns a data.table object
        })
      })

      output$dmatrix <- renderDataTable({
        datatable(rv$mat, rownames = F, filter = list(position = 'top', 
clear = T, plain = T), style = 'bootstrap') %>% formatCurrency("PY_ROT1")
       })

预先感谢

基督徒

0 个答案:

没有答案
相关问题