extractDate | R Documentation |
This function helps to extract dates from a vector of files.
extractDate(files, pos1, pos2, asDate = FALSE, format = "%Y%j")
files |
A |
pos1, pos2 |
Start and end of date string in 'files' as |
asDate |
|
format |
|
A list
with the following entries: 'inputLayerDates', 'pos1', 'pos2',
'asDate' and, optionally, 'format'. If asDate = FALSE
(default),
'inputLayerDates' are represented as character
, else as Date
.
Matteo Mattiuzzi
# example on HDF files files <- c("MOD13Q1.A2010209.h18v03.005.2010239071130.hdf", "MOD13Q1.A2010225.h18v03.005.2010254043849.hdf") extractDate(files) extractDate(files, asDate = TRUE) # on any other file files <- c("Myfile_20010101.XXX", "Myfile_20010115.XXX", "Myfile_20010204.XXX") extractDate(files, pos1 = 8, pos2 = 15) extractDate(files, pos1 = 8, pos2 = 15, asDate = TRUE, format = "%Y%m%d")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.