why "subscript out of bounds" error in Shiny but not R?

500 views
Skip to first unread message

Byran Smucker

unread,
Apr 29, 2014, 10:03:58 PM4/29/14
to shiny-...@googlegroups.com

Hello,

We have a confounding issue in the Shiny app that we are developing. As the subject indicates, we get an "error: subscript out of bounds" message upon running the app. However, when we isolate the offending code and run it on its own in RStudio, there is no error.

Please see the instructions below and the attached .R files for details. We are using Shiny version 0.8.0 and RStudio 0.98.501.

Is this a Shiny bug, or are we missing something?

Thanks,
Byran Smucker

----

To run the app, place ui.R and server.R (both attached) in a folder and run

library(shiny)
runApp("<folder path>")

It should produce a user interface with a button on the left, but on the right you will see "error: subscript out of bounds".

However, if just run the following three lines of code (lines 57-59 in server.R)

  show=data.frame(ps=c(4,-1,0,1),ns=c(0,1,0,0),ts=c(45842,15653,28535,21656))
  best.fit1=regsubsets(ts~ps+ns,data=show,nvmax=1)
  pred1=predict.regsubsets(best.fit1,show,id=1)  # line that offends Shiny

in RStudio (need to include the function "predict.regsubsets" - given at the beginning of server.R), then there are no errors.
server.R
ui.R
Message has been deleted
Message has been deleted
Message has been deleted

John Harrison

unread,
Apr 30, 2014, 8:43:03 AM4/30/14
to shiny-...@googlegroups.com
I posted several replies to this post but I think the spam filter kept deleting them.

Byran Smucker

unread,
Apr 30, 2014, 8:51:07 AM4/30/14
to shiny-...@googlegroups.com
John, feel free to e-mail me directly at absm...@gmail.com.
Byran
Reply all
Reply to author
Forward
Message has been deleted
0 new messages