输入闪亮的可变数据

时间:2020-10-30 12:24:51

标签: r shiny

我正在寻找一个闪亮的应用程序,用户可以在其中上传文本文件,并可以输入要过滤的字词(因此,句子中包含两个特定的单词或短语)。然后他们可以下载结果。到目前为止,我的脚本如下:

ui <- fluidPage(
  titlePanel("Download data"),
  sidebarLayout(
    sidebarPanel(
      fileInput("file1", "Choose .txt file",
                multiple = F,
                accept = c(".txt")),
      textInput('energy_co', 'Name of energy company'),
      textInput('asset', 'name of Asset Manager'),
      downloadButton("downloadData", "Download")
    ),
    
    mainPanel(
      tableOutput("table")
    )
    
  )
)




server <- function(input, output, session) {
  
  options(shiny.maxRequestSize=30*1024^2)

  
  output$table <- renderTable({  
  req(input$file1)
  
    data <- read_lines(input$file1$datapath)
    text_df <- as_data_frame(data)
    
    company_data <- text_df %>% 
      filter(str_detect(terms, input$asset)) %>%   
      filter(str_detect(terms, input$energy_co)) %>% 
      distinct(.)
    
    company_data
    
    })
  output$downloadData <- downloadHandler(
    filename = function() {
      paste(company_data, ".csv", sep = "")
    },
    content = function(file) {
      write.csv(company_data, file1, row.names = FALSE)
    }
  )
  
}


shinyApp(ui, server)

我可以上传数据集(.txt文件),但是当我尝试渲染表或尝试将结果以csv格式下载时都没有任何反应。我认为服务器脚本可能需要是被动的?任何帮助表示赞赏

1 个答案:

答案 0 :(得分:2)

尝试一下

1>C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.1\common\inc\helper_cuda.h(571): error : argument of type "CUresult" is incompatible with parameter of type "cudaError_t"
1>          detected during instantiation of "void check(T, const char *, const char *, int) [with T=CUresult]"
1>C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.1\common\inc\helper_cuda_drvapi.h(123): here