including other 'source' files to shinyapps.io

37 views
Skip to first unread message

Justin Lent

unread,
Jul 20, 2014, 9:57:35 AM7/20/14
to shinyap...@googlegroups.com
when i run my shiny apps locally i often have several source() calls in my server.R file to load in general utility functions that i use across my apps.  How can simply deploy these utility.R files to shinyapps.io and modify my source() calls in my server.R file to reference them in the deployed shinyapps.io environment?

right now, my workaround is to manually copy/paste all the utility functions to the top of server.R before running deployApp() which is pretty time consuming

thanks!


Tareef Kawaf

unread,
Jul 20, 2014, 2:21:45 PM7/20/14
to Justin Lent, shinyap...@googlegroups.com
I am actually facing the same issue myself :)  I just tried linking the directory that has my shared code underneath the directory that the server.R and ui.R files are in, and changed the path for the source function.  

Would that work for you?


--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/6c2a311c-eedf-4059-988f-58a27e8d9478%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Lent

unread,
Jul 20, 2014, 2:40:44 PM7/20/14
to Tareef Kawaf, shinyap...@googlegroups.com
Tareef,
thanks for the idea! so am I understanding correctly that any subdirectory under where server/UI.R are located will also be "copied" over to the shinyappsio server when I run deployApp() ?  do I then just reference it in  my source call by doing something like this for the path: source( "~/myUtilities/utilityfunctions.R")

if I've missed where this is mentioned in the documentation can you point me to where I can find it :)
--
** Sent from my iPhone *

Tareef Kawaf

unread,
Jul 20, 2014, 3:14:03 PM7/20/14
to Justin Lent, shinyap...@googlegroups.com
There is nothing in the docs :)  It is something I just started experimenting with to try and solve the problem that shinyapps bundles the directory (and sub-directories) when it pushes up to ShinyApps.io so you can't reference files that are not in there.

In your case, you would probably want to do something like the following from the directory that contains your ui.R and server.R:

> ln -s myUtilities ~/myUtilities

and change your source call to:  source("myUtilities/utilityfunctions.R")

Let me know if that works for you.
Reply all
Reply to author
Forward
0 new messages