epicR Configuration Management
epicR-config.RdThe epicR package now supports user-customizable configuration files. When the package is loaded for the first time, configuration files are automatically copied to a user-specific directory following CRAN policy. You can modify these files to customize model parameters for your specific region or research needs.
Configuration Directory
User configuration files are stored in a platform-specific location determined
by tools::R_user_dir("epicR", "config"). Use get_user_config_dir()
to find the exact path on your system.
Available Functions
get_user_config_dir: Get the path to user config directoryuser_config_exists: Check if a user config existscopy_configs_to_user: Copy default configs to user directoryreset_user_configs: Reset configs to package defaultslist_available_jurisdictions: List available config jurisdictionsvalidate_config: Validate a configuration file
Usage
The package automatically uses user configs if they exist. When you call
get_input(), it will:
First check for user config files in the user config directory
If found, use the user's customized configuration
If not found, fall back to package default configurations
Customizing Configurations
To customize configurations for your region:
The config files are automatically copied on first package load
Edit the JSON files (e.g., `config_canada.json`, `config_us.json`)
Save your changes
The next time you use
get_input(), your changes will be used
Adding New Jurisdictions
To add a new jurisdiction:
Copy an existing config file (e.g., `config_canada.json`)
Rename it to `config_yourcountry.json`
Update the "jurisdiction" field in the JSON to match
Modify all parameters as needed for your region
Use with:
get_input(jurisdiction = "yourcountry")
Resetting to Defaults
If you need to reset your configurations:
Reset all configs:
reset_user_configs()Reset specific jurisdiction:
reset_user_configs("canada")
Examples
if (FALSE) { # \dontrun{
# Check where user configs are stored
get_user_config_dir()
# List available jurisdictions
list_available_jurisdictions()
# Validate your custom config
validate_config("canada", user = TRUE)
# Reset to package defaults if needed
reset_user_configs("canada")
# Use your custom config
input <- get_input(jurisdiction = "canada")
} # }