deploy shiny app sourcing R files

353 views
Skip to first unread message

Andrea Elia

unread,
Feb 25, 2016, 2:28:44 PM2/25/16
to Shiny - Web Framework for R
Hi everybody,

I want to deploy a shiny application which require the source of a R function file. 
Locally I saved this file in the same folder of the application, and in the server file I add the sourcing code:

source("function.R", echo=TRUE)

There is no problem when using the application locally. 
But when I deploy the application the following error appears:

Disconnession from server


It could be related to the sourcing of the file? 
Do you know which is the correct way to source R file or is it now allowed?

Thank you in advance!!!!

sanjana jha

unread,
Apr 15, 2016, 1:39:00 AM4/15/16
to Shiny - Web Framework for R
Hi Andrea,

I wanted to ask whether your erroe "apllication greys out" has been rectified? If yes,can you please let me know how did you do this as even I am struggling with the same problem.

Thanks And Regards
Sanjana Jha

Andrea Elia

unread,
Apr 15, 2016, 5:47:43 AM4/15/16
to Shiny - Web Framework for R
Hi Sanjana,

at the moment I didn't find a good solution, so I just applied a trick that I don't like but it works.
So I copied the r function code directly inside the server.r file, so that now the r functions are loaded directly inside it.
Maybe this is not the correct way (my server.r file has know more than 3000 rows...), and I cannot says if the loading can take a little extra-time with this solution.
I think that the correct way should be to create, test and develop an r package containing your function/s, then distribute and publish it on the Cran or the GitHub using devtools. So in this way you will load your function just loading the package, using library("...") in the server.r file, but this work requires time.
Let me know if you find a smarter way to do it :)

Thank you!!!

sarath kumar

unread,
Nov 30, 2016, 12:54:42 AM11/30/16
to Shiny - Web Framework for R
HI Andrea Elia &  Sanjana,

I am also facing the same problem. Have you found the solution. If you found please share here:

In my app i included souce function for end user. End user can run his script (according to my app) in my app. I tried shiny files, Tcltk packages it was not helping me.
You posted this question 1 1/2 year before from now. I hope you may found the solution. please share the things .
Reply all
Reply to author
Forward
0 new messages