I am using:
source("script.R)
the glycoPipe function is inside script.R and would like to be able to call it from the shiny app. I have written the code below, but I do not know how to extract some of the variables that are initialized in the function. Any suggestions?
How do I do this, if the code is not in a reactive context and there are not inputs being entered though the UI other than run the program, for example?
If you include it in the server function, then glycoPipe will be run once at the start of each session. If you save its returned value in a variable, you can use it elsewhere. Example:
If the glycoPipe function takes parameters such as gltcoPipe <- function(n = NULL, n2 = TRUE), for example, should result in the server function be like result <- glycoPipe(n = NULL, n2 = TRUE)?
Yes. The call to glycoPipe in the server function is handled just like in a normal R session. Again, it will only be called once at the start of each session. So the value of result for the session is determined by what's given to glycoPipe at the beginning.
If you want the result to change during the session, you'd need to wrap it in a reactive value.
I am trying to pass a parameter from the server function in the ShinyApp to an external sourced script. The sourced script has a parameter in the function definition to take the input from the calling function. I cannot retrieve the passed parameter in the called script. Do I need to do some thing else to get the variable passed?