setup_config {epitweetr} | R Documentation |
Load epitweetr application settings
Description
Load epitweetr application settings from the designated data directory
Usage
setup_config(
data_dir = if (exists("data_dir", where = conf)) conf$data_dir else if
(Sys.getenv("EPI_HOME") != "") Sys.getenv("EPI_HOME") else file.path(getwd(),
"epitweetr"),
ignore_keyring = FALSE,
ignore_properties = FALSE,
ignore_topics = FALSE,
save_first = list()
)
Arguments
data_dir |
Path to the directory containing the application settings (it must exist). If not provided it takes the value of the latest call to setup_config in the current session, or the value of the EPI_HOME environment variable or epitweetr subdirectory in the working directory, default: if (exists("data_dir", where = conf)) conf$data_dir else if (Sys.getenv("EPI_HOME") != "") Sys.getenv("EPI_HOME") else file.path(getwd(), "epitweetr") |
ignore_keyring |
Whether to skip loading settings from the keyring (Twitter and SMTP credentials), default: FALSE |
ignore_properties |
Whether to skip loading settings managed by the Shiny app in properties.json file, Default: FALSE |
ignore_topics |
Whether to skip loading settings defined in the topics.xlsx file and download plans from topics.json file, default: FALSE |
save_first |
Whether to save current settings before loading new ones from disk, default: list() |
Details
epitweetr relies on settings and data stored in a system folder, so before loading the dashboard, collecting tweets or detecting alerts the user has to designate this folder.
When a user wants to use epitweetr from the R console they will need to call this function for initialisation.
The 'data_folder' can also be given as a parameter for program launch functions epitweetr_app
, search_loop
or detect_loop
, which will internally call this function.
This call will fill (or refresh) a package scoped environment 'conf' that will store the settings. Settings stored in conf are:
General properties of the Shiny app (stored in properties.json)
Download plans from the Twitter collection process (stored in topics.json merged with data from the topics.xlsx file
Credentials for Twitter API and SMTP stored in the defined keyring
When calling this function and the keyring is locked, a password will be prompted to unlock the keyring. This behaviour can be changed by setting the environment variable 'ecdc_twitter_tool_kr_password' with the password.
Changes made to conf can be stored permanently (except for 'data_dir') using:
Value
Nothing
See Also
save_config
set_twitter_app_auth
epitweetr_app
search_loop
detect_loop
Examples
if(FALSE){
library(epitweetr)
#loading system settings
message('Please choose the epitweetr data directory')
setup_config(file.choose())
}