1

I need some advice on how to take a working app from your local machine onto a web deployment.

I tried deploying an App to Shinyserver.io, but I have path errors. It cannot find my utilities code in utils-fun.R.

Error message

The application failed to start.

Error in eval(expr, envir, enclos) : could not find function "GetSettings"

For example: my server.R is in an App directory

library(shiny)
code...

source("../code/utils-fun.R")

... rest of code

How do you help RShiny know what it needs to take with when it is deploying?
Should the structure of your directories rather be more like this.

-Root or App directory

ui.R Server.R

-- code (as subdirectory where my functions are)

-- data (rds and data files)

With everything in one directory, underneath the ui.R /server.R files?

I see from using-source-in-shiny that I need to add local = TRUE to my source but is that all you need?

Thanks I would appreciate any sage advice of how you implement R Shiny.

Community
  • 1
  • 1
micstr
  • 5,080
  • 8
  • 48
  • 76

1 Answers1

1

For tidiness I keep my source files in a folder called "files" alongside ui.r and server.r. Since the working directory for a shiny app is the folder where ui.r and server.r are kept you can use source("files/script.r").

steinbock
  • 726
  • 1
  • 12
  • 25
  • Thanks. Do you use `local = TRUE` as well? Are there any environment "tricks/traps" I must watch out for? – micstr May 12 '15 at 06:14
  • No, I never use local=TRUE and haven't had problems yet. Under http://shiny.rstudio.com/articles/scoping.html you can find the scoping rules for shiny and under http://stackoverflow.com/questions/23409267/environments-in-r-shiny my take on setting local and gloabl variables incase this of relevance for you. – steinbock May 12 '15 at 06:50