2

I am aware of the common mistakes discussion on this topic. I've tried various combinations of adding or deleting IDs, labels, and commas and I can't seem to figure out what is wrong with my code.

Right now my app doesn't do anything substantial, I'm just trying to get it set up. Right now, expected behavior is that it runs, allows the user to enter any text, hit a submit button, and returns "hello world!"

server.R code:

library(shiny)
shinyServer(   
  function(input, output) {
   output$results <- renderText({
              "hello world!"           
              }) 
  }
)                               

ui.R code:

library(shiny)
shinyUI(fluidPage(
   titlePanel("Title goes here."),
   sidebarLayout(
      sidebarPanel(
      helpText("Enter a few words, then select 'submit'!"),
      textInput("input"),
      submitButton("submit", label = "submit"),
   ),
mainPanel(
  textOutput("results")
  )
)
))

Actual behavior returns this error on the browser:

ERROR: argument "label" is missing, with no default

And this error in the R console:

> shiny::runApp()
Listening on http://127.0.0.1:4635
Error in label %AND% tags$label(label, `for` = inputId) : 
  argument "label" is missing, with no default
Error in label %AND% tags$label(label, `for` = inputId) : 
  argument "label" is missing, with no default

Any general suggestions for debugging shiny apps will be greatly appreciated!

zx8754
  • 52,746
  • 12
  • 114
  • 209
wugology
  • 193
  • 1
  • 4
  • 13
  • Related: http://stackoverflow.com/questions/31920286/effectively-debugging-shiny-apps/31945359 – sdgfsdh Oct 07 '15 at 08:54
  • Related: [One of the common mistakes: Delete the comma at the end](https://stackoverflow.com/questions/22626412/error-in-rshiny-ui-r-argument-missing) – zx8754 Sep 13 '17 at 08:23

2 Answers2

3

textInput needs a label and submitButton doesn't.

Try this:

  textInput("input", "A Label"),
  submitButton("submit")

Also you have an additional comma after submitButton.

Unfortunately I'm quite new too R too, I have no suggestions to debug Shiny App.

mucio
  • 7,014
  • 1
  • 21
  • 33
  • Oh wow thank you! Also I noticed you deleted a comma. Gah! Do you have any suggestions for how I would have known to try that rather than the 10 other things I tried first? – wugology Apr 23 '15 at 18:09
  • 1
    I was able to reproduce on my machine, then I started to hammer the code till it worked :) – mucio Apr 23 '15 at 18:10
  • 1
    actually a way, that I used to "debug" your code, was F1 on RStudio to figure out the required and optional parameters for the functions you used – mucio Apr 23 '15 at 20:20
0

You can debug R Shiny using browser() command in server part. Execution will be stopped at this place