| epicR-config | R Documentation |
The 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.
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.
get_user_config_dir: Get the path to user config directory
user_config_exists: Check if a user config exists
copy_configs_to_user: Copy default configs to user directory
reset_user_configs: Reset configs to package defaults
list_available_jurisdictions: List available config jurisdictions
validate_config: Validate a configuration file
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
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
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")
If you need to reset your configurations:
Reset all configs: reset_user_configs()
Reset specific jurisdiction: reset_user_configs("canada")
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.