当我尝试访问input $ variable时,它没有提供我选择的所需列,因此output $ Subset无法正常工作
server.r
shiny::shinyServer(
function(input,output)
{
library(shiny)
data<-reactive({
file1<-input$file
if(is.null(file1)){return()}
read.table(file1$datapath,header = input$header,stringsAsFactors = input$Strgs,sep = input$button)
})
c<-reactive({
names(data())
})
output$df<-renderTable({
if(is.null(data())){return()}
input$file
})
output$sum<-renderTable({if(is.null(data())){return()}
summary(data())
})
output$full<-renderTable({
if(is.null(data())){return()}
data()
})
output$top<-renderTable({
if(is.null(data())){return()}
head(data())
})
output$bottom<-renderTable({
if(is.null(data())){return()}
tail(data()[,])
})
output$vx<-renderUI({
selectInput("variable","choose the column",choices=c(),selected=c()[1])
})
output$subset<-renderTable(
data()[,input$variable]
)
}
)