How can I read the input file into brilliant?
You have several options. I assume you know how to read a file in R using
or something similar.
You can put input
in one of three places:
1) Globlal.r: If you have a file
, you can use
there and the data will be directly available to functions
, Usually you don't need to do this, but this is an option.
For the next two parameters, the data will be available directly to the party
, but must be passed to the party
through one of the functions
2) Server.r, but NOT in shinyServer: In this case, it
is in the file
, but outside the function
. The file will be read in one time per session and will not change. This is the usual place to read data.
3) Server.r and shinyServer: In this case it
is part of the function
. This is a good place to read data if you want some degree of reactivity involved. For example, if a user chooses what data to enter, or if the data file is constantly updated (perhaps stock prices) and you want to periodically check the data file for updates while the user is logged on.
Note. You also need to consider where the data is stored. You can put it in a subdirectory of your application directory and then read it using a relative (not absolute) path. This is useful if you are testing your application on your desktop but are going to deploy it elsewhere and do not want to rewrite your code to take into account the new directory structure.
source to share