【问题标题】:Error while Running a simple Shiny app运行简单的 Shiny 应用程序时出错
【发布时间】:2016-06-22 22:55:18
【问题描述】:

我正在尝试运行一个简单的 Shiny 应用程序,该应用程序需要几个文本输入来生成 SQL 语句。当我取消注释 textInput 控件时,我不断收到以下错误。

match.arg(position) 中的错误:'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"))
)
)
))

server.R 图书馆(闪亮)

shinyServer(function(input, output) {


 output$sqlText <- renderPrint({


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

 })

注释 textInput() 行,我可以运行应用程序。我无法弄清楚我在 textInput 函数中缺少什么以显示错误。非常感谢任何帮助。

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    我想你想把所有输入都放在你的 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"))
                    ))
    
    ))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-23
      • 2017-09-20
      • 2017-04-01
      • 2019-10-14
      • 2012-05-13
      • 1970-01-01
      相关资源
      最近更新 更多