Description Usage Arguments Value Author(s) Examples
This function helps to extract dates in a vector of files
1 | extractDate(files,pos1=10,pos2=16,asDate=FALSE,format='%Y%j')
|
files |
vector of filenames where from extract the dates. Can include also the filepath! |
pos1 |
Start position of date in the filename. You have to count, sorry! |
pos2 |
End position of date in the filename. You have to count, sorry! |
asDate |
Logical, default is FALSE. If TRUE the result is converted to a |
format |
Used only if |
Vector with character, if asDate=FALSE
or vector of "Date"'s if TRUE, extracted from filenames
Matteo Mattiuzzi
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# 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")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.