如何在R中使用checkboxGroupInput中的被动数据列?

如何在R中使用checkboxGroupInput中的被动数据列?,r,shiny,R,Shiny,我有以下代码: # Preloads ---- library(shiny) library(dplyr) library(xlsx) library(jsonlite) library(httr) library(svDialogs) library(downloader) library(DT) params <- readLines("params.json") # Define UI ---- ui <- fluidPage( titlePanel("Arsena

我有以下代码:

# Preloads ---- 
library(shiny)
library(dplyr)
library(xlsx)
library(jsonlite)
library(httr)
library(svDialogs)
library(downloader)
library(DT)
params <- readLines("params.json")

# Define UI ----
ui <- fluidPage(
    titlePanel("Arsenal Prime Contracts"),
    sidebarPanel(fluidRow(
        column(12, textInput("the_duns", h4("Please enter a DUNS number: "), 
                             placeholder = "Enter text...")),
        column(12, actionButton("submit", "Submit")))),
    mainPanel(
    column(12, 
           checkboxGroupInput(
               inputId = "agency", 
               label = "What funding agencies would you like to include?",
               choices = unique(the_data),
               selected = NULL))),
    textOutput("duns"))


# Define server logic ----
server <- function(input, output, session) {
        observeEvent(input$submit, { 
            params[5] <- paste0("          \"recipient_search_text\": [\"",
                                as.character(input$the_duns), "\"]")
            writeLines(params,"params.json")
        # the excel workbook to download 
        pages<-list()
        url<-"https://api.usaspending.gov/api/v2/download/awards"
        API_response <- httr::POST(url, body = upload_file("params.json"))
        stop_for_status(API_response)
        json <- content(API_response, "text",encoding = "UTF-8")
        API_data <- fromJSON(json)
        Sys.sleep(5)
        download(API_data[["url"]], dest="dataset.zip", mode="wb") 
        unzip("dataset.zip", exdir = getwd())
        output1 <- read.table(unz("dataset.zip", "all_contracts_prime_awards_1.csv"),
                              header=T, quote="\"", sep="," ,fill = TRUE)
        output2 <- read.table(unz("dataset.zip", "all_contracts_prime_awards_1.csv"),
                              header=T, quote="\"", sep="," ,fill = TRUE)
        the_data <- DT::renderDataTable({
            as.data.frame(output1$funding_agency_name)
        })
        })
}

# Run the application ----
shinyApp(ui = ui, server = server)
#预加载--
图书馆(闪亮)
图书馆(dplyr)
图书馆(xlsx)
图书馆(jsonlite)
图书馆(httr)
库(SVD对话框)
库(下载程序)
图书馆(DT)

params您可以提供
params.json
文件`{“过滤器”:{“奖励类型代码”:[“A”、“B”、“C”、“D”],“时间段”:[{“开始日期”:“2009-11-06”,“结束日期”:“2019-11-04”}],“收件人搜索文本”:[“879186468”}`