2016-03-08 43 views
1

我想運行一個簡單的Shiny應用程序,它需要幾個文本輸入來生成一條SQL語句。當我對textInput控件取消註釋時,我不斷收到以下錯誤。在match.arg(位置)運行一個簡單的Shiny應用程序時出錯

錯誤:ARG'必須是NULL或字符向量

我正在運行的代碼是: ui.R

library(shiny) 

shinyUI(fluidPage(

# Application title 
titlePanel("SQL Developer"), 

# Sidebar with a slider input for number of bins 
sidebarLayout(
sidebarPanel(
    sliderInput("topnrows", 
       "Number of rows to show:", 
       min = 1, 
       max = 100, 
       value = 50) 
), 

textInput("text1", label = "Text input", value = "Enter text..."), 
# textInput("dbName", 
#   label="Enter the Database Name", 
#   value="Enter Database Name"), 
# textInput("tableName", 
#   "Enter the Table Name"), 


# Show a plot of the generated distribution 
mainPanel(
h3(textOutput("sqlText")) 
) 
) 
)) 

服務器。 ř 庫(有光澤)

shinyServer(function(input, output) { 


output$sqlText <- renderPrint({ 


paste("select top ", input$topnrows, " * from trial.table",sep='') 
}) 

}) 

談到的TE xtInput()行,我可以運行該應用程序。我一直無法找出我在textInput函數中缺少的內容以顯示錯誤。任何幫助是極大的讚賞。

回答

0

我想你想要把你sidebarPanel()內的所有輸入:

shinyUI(fluidPage(

     # Application title 
     titlePanel("SQL Developer"), 

     # Sidebar with a slider input for number of bins 
     sidebarLayout(
       sidebarPanel(
         sliderInput("topnrows", 
            "Number of rows to show:", 
            min = 1, 
            max = 100, 
            value = 50), 
       textInput("dbName", 
          label="Enter the Database Name", 
          value="Enter Database Name"), 
       textInput("tableName", 
          label="Enter the Database Name", 
          value="Enter the Table Name"), 
       textInput("text1", label = "Text input", value = "Enter text...") 
     )     
       , 


       # Show a plot of the generated distribution 
       mainPanel(
         h3(textOutput("sqlText")) 
       )) 

)) 
相關問題