View source: R/01-core-utilities.R
| extract_dates_universal | R Documentation |
Universal function to extract dates from filenames or provide custom labels. Enhanced with more flexible regex patterns that work with any filename prefix.
extract_dates_universal(input_data, date_patterns = NULL, verbose = FALSE)
input_data |
Character vector (file paths or folder), or list of raster layers |
date_patterns |
Named list of custom regex patterns for date extraction |
verbose |
Print progress messages |
Character vector of extracted or inferred date labels
## Not run:
# These examples require external data files not included with the package
# Extract dates from filenames
dates <- extract_dates_universal(c("ndvi_2023-05-15.tif", "evi_2023-06-15.tif"))
# Custom date patterns
custom_patterns <- list("MMDDYYYY" = "\\b[0-9]{2}[0-9]{2}[0-9]{4}\\b")
dates <- extract_dates_universal(files, custom_patterns)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.