check_data_update {reptiledb.data} | R Documentation |
Check if reptile database data needs updating based on date comparison
Description
This function checks if the local reptile database data is up-to-date by comparing the date extracted from the local dataset name with the date from the latest available file on The Reptile Database website.
Usage
check_data_update(silent = FALSE, check_connection = TRUE)
Arguments
silent |
Logical. If TRUE, suppresses messages and only returns results. Default is FALSE. |
check_connection |
Logical. If TRUE, checks internet connection before attempting to access online data. Default is TRUE. |
Value
A list containing the following elements:
- update_needed
Logical. TRUE if an update is needed, FALSE otherwise
- local_info
List. Information about the local dataset
- remote_info
List. Information about the remote dataset
- message
Character. Status message describing the comparison result
- recommendation
Character. Recommendation for user action
- local_date
Character. Date of local data in YYYY-MM-DD format
- remote_date
Character. Date of remote data in YYYY-MM-DD format (if available)
- remote_filename
Character. Filename of the remote file (if available)
- days_difference
Numeric. Number of days difference between local and remote data (if both dates available)
If an error occurs or internet connection is not available, only the message element will contain relevant error information.
Examples
# Silent check (no messages) - requires internet connection
update_status <- check_data_update(silent = TRUE)
# Verbose check with connection verification
update_status <- check_data_update(silent = FALSE, check_connection = TRUE)
# Check without internet connection verification
update_status <- check_data_update(check_connection = FALSE)