R 尝试使用tableoutput时出错

R 尝试使用tableoutput时出错,r,shiny,R,Shiny,我使用的是一个基本的闪亮代码,当我试图显示tableoutput时,它会给出一个错误,但当我将line更改为renderprint时,会打印相同的数据帧。我可以使用下载处理程序下载该文件,该处理程序显示有记录。 “警告:错误,我很难准确地找出问题所在。听起来你想在某个地方使用renderprint,但这不起作用;是这样吗?你能在你想使用的地方发布一个带有renderprint的例子吗?为什么在项目中使用renderprint很重要?另外,structure提供的表格对示例是否重要?正如我已经解释

我使用的是一个基本的闪亮代码,当我试图显示tableoutput时,它会给出一个错误,但当我将line更改为renderprint时,会打印相同的数据帧。我可以使用下载处理程序下载该文件,该处理程序显示有记录。
“警告:错误,我很难准确地找出问题所在。听起来你想在某个地方使用
renderprint
,但这不起作用;是这样吗?你能在你想使用的地方发布一个带有
renderprint
的例子吗?为什么在项目中使用
renderprint
很重要?另外,
structure
提供的表格对示例是否重要?正如我已经解释过的,renderprint可以工作并在dataframe中显示数据,但我需要以TablerFormat显示输出,这会引发此错误。
structure(list(Point1 = c(9999, 9999, 433.333, 9999, 1433.333, 
33.333, 4283.333, 9999, 33.333, 9999, 9999, 9999, 9999, 0.033, 
1323.333, 883.333, 9999, 9999, 9999, 9999, 433.333, 1433.333, 
0.633, 9999, 9999, 9999, 33.333, 9999, 133.333, 433.333, 433.333, 
0.003, 4023.333, 33.333, 423.333, 1323.333, 423.333, 1323.333, 
4323.333, 2073.333, 1323.333, 1323.333, 1323.333, 1323.333, 1323.333, 
33.333, 123.333, 3363.333, 123.333, 0.333, 423.333), Point2 = c(4433.333, 
4433.333, 133.333, 4133.333, 433.333, 3.333, 1283.333, 4433.333, 
3.333, 4433.333, 4433.333, 4433.333, 4433.333, 0.003, 423.333, 
433.333, 4433.333, 4433.333, 4433.333, 4433.333, 133.333, 433.333, 
0.333, 4358.333, 4433.333, 4433.333, 3.333, 4433.333, 33.333, 
133.333, 133.333, NA, 1323.333, 3.333, 123.333, 423.333, 123.333, 
423.333, 1323.333, 1323.333, 423.333, 423.333, 423.333, 423.333, 
423.333, 3.333, 33.333, 1323.333, 33.333, 0.033, 123.333), OUTP1 = c(NA, 
NA, 1L, NA, 1L, 1L, 1L, NA, 1L, NA, NA, NA, NA, 1L, 1L, 1L, NA, 
NA, NA, NA, 1L, 1L, 1L, NA, NA, NA, 1L, NA, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L), Types = c(NA, NA, 3L, NA, 3L, 3L, 3L, NA, 3L, NA, NA, 
NA, NA, 3L, 3L, 3L, NA, NA, NA, NA, 3L, 3L, 3L, NA, NA, NA, 3L, 
NA, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L)), .Names = c("Point1", "Point2", 
"OUTP1", "Types"), class = "data.frame", row.names = c(NA, -51L
))


    library(survival)
    library(shiny)
           ui <- bootstrapPage(
           titlePanel("Title comes here"),
           tags$hr(),
           sidebarPanel(
           fileInput("file1", "Choose CSV File",
           multiple = FALSE,
            accept = c("text/csv",
            "text/comma-separated-values,text/plain",
            ".csv")),
         tags$hr(),
        checkboxInput("header", "Header", TRUE),

        radioButtons("sep", "Separator",
                     choices = c(Comma = ",",
                                 Semicolon = ";",
                                 Tab = "\t"),
                     selected = ","),

        radioButtons("quote", "Quote",
                     choices = c(None = "",
                                 "Double Quote" = '"',
                                 "Single Quote" = "'"),
                     selected = '"'),

        tags$hr(),

        radioButtons("disp", "Display",
                     choices = c(Head = "head",
                                 All = "all"),
                     selected = "head"),

        downloadButton("downloadData", "Download")
    ),
    mainPanel(
        # plotOutput('plot'),
        tableOutput("selected_var")
    )
    )
     server <- function(input, output) {

    data <- reactive({
        req(input$file1)

        test1 <- read.csv(input$file1$datapath,
                                header = input$header,
                                sep = input$sep,
                                quote = input$quote)
        test1[is.na(test1)] <- "0"

        return(list(df = test1))
    })
    output$selected_var <- renderTable(data()$df)
    }

    shinyApp(ui = ui, server = server)
`