通过Rshiny向javascript提供数据

时间:2017-10-06 09:01:50

标签: javascript r shiny

我需要将作为输出生成的filtered_data.csv发送到javascript,以便数据可用于javascript支持的酷炫可视化,我知道可以在闪亮和各种d3支持的库中使用htmlwidgets,但不是我的要求在这种情况下。有关如何实现Rshiny / R和Javascript之间连接以推送数据的任何指示都会有所帮助

shinyApp(
  ui = 
    shinyUI(
      fluidPage(
        title = 'ApplicationA',
        DT::dataTableOutput("dt"),
        theme = shinytheme("flatly"),
        p("Notice that the 'rows_all' attribute grabs the row indices of the data."),
        verbatimTextOutput("filtered_row"),


        downloadButton(outputId = "download_filtered",
                       label = "Download Filtered Data")
      )
    ),

  server = 
    shinyServer(function(input, output, session){
      output$dt <- 
        DT::renderDataTable(
          datatable(cleandata,
                    filter = "top")
        )

      output$filtered_row <- 
        renderPrint({
          input[["dt_rows_all"]]
        })


      output$download_filtered <- 
        downloadHandler(
          filename = "Filtered Data.csv",
          content = function(file){
            write.csv(cleandata[input[["dt_rows_all"]], ],
                      file)
          }
        )
    })
)

0 个答案:

没有答案