Reputation: 11
I am trying to run a simple Shiny App that takes a couple of text inputs to generate an SQL statement. I keep getting the following error when I have the textInput control uncommented.
Error in match.arg(position) : 'arg' must be NULL or a character vector
The code I am running is: 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 library(shiny)
shinyServer(function(input, output) {
output$sqlText <- renderPrint({
paste("select top ", input$topnrows, " * from trial.table",sep='')
})
})
Commenting the textInput() lines, I can run the app. I haven't been able to figure out what I was missing in the textInput function for the error to show up. Any help is greatly appreciated.
Upvotes: 1
Views: 370
Reputation: 19544
I think you want to put all input within your 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"))
))
))
Upvotes: 0