-2

What is wrong? I get ERROR: argument is of length zero in shiny::runApp when I run

library(shiny)
runApp("C:\\R\\4p\\frontEnd2\\shiny")

Sometimes it works, sometimes not. When I restart it usually begin to work again.

W W
  • 769
  • 1
  • 11
  • 26
  • 1
    The problem is likely within your shiny code. Please make this a [reproducible question](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including relevant code. – r2evans Nov 17 '17 at 18:57
  • How can I paste all code when the server has 300 lines of code, ui 300 lines of code and functions 300 lines of code more! How can I debug it? – W W Nov 17 '17 at 18:59
  • 1
    I'll counter with this: how can we help you debug your code when we see none of it? Your challenge is to try to reproduce your error with as little code as possible. One technique is to create a new version of your `frontEnd2` (another dir, perhaps), and iteratively add one *small* feature and test it to make sure it runs ... until you find a feature that is causing problems. (BTW: you are correct thinking that pasting all 900 lines of code here is not the best way to go.) – r2evans Nov 17 '17 at 19:01
  • What error should I look for? Connected with what? With null values? Why R has no debuger for shiny? All trace I get is :`Stack trace (innermost first): 1: runApp Error : argument is of length zero` – W W Nov 17 '17 at 19:04
  • 2
    Make a shiny app with a "hello" `ui` and relatively functionless `server`. Run it, no errors. Add UI elements; you might be able to add all of them (with no server components). Run it, hope for no errors. Source your functions into the app, but still no real `server` functionality. Run it, hope for no errors. Then, piece-by-piece, add a *small block of code* into your `server` component. Run it, hope for no errors. Welcome to troubleshooting shiny. – r2evans Nov 17 '17 at 19:07
  • man! this is horror! – W W Nov 17 '17 at 19:12
  • 1
    Hindsight suggests that you should have been testing the shiny app *as you wrote it* vice waiting until you had 900 lines of code. I'm not trying to kick you when you're down, but it's worth noting that few people can write shiny apps "that long", completely error-free the first time. I'm not one of them, and I consider myself proficient in R. – r2evans Nov 17 '17 at 19:15
  • It had been working all the time, until suddenly this strange error begun appearing. When I was restarting R then everything was runing good again. Few more changes and now restarts don't help... it completely died. – W W Nov 17 '17 at 19:18

1 Answers1

0

Finally I found it manually. UI has using a variable from global which was numeric and UI was treating it as a factor levels(x)[1]

micstr
  • 5,080
  • 8
  • 48
  • 76
W W
  • 769
  • 1
  • 11
  • 26