ctime_filt | R Documentation |
Identify earliest or latest file(s) by creation/modified/access time
ctime_filt( x, pattern, type = c("max", "min"), what_finfo = c("ctime", "mtime", "atime"), only_last = TRUE, fmt = "%Y-%m-%d", print_limit = 6L, ... )
x |
Input file path |
pattern |
Optional regex passed to |
type |
One of "min" or "max" (quotes explicit) to denote if function should find earliest or latest file by file.info file time, respectively. Defaults to "max" (most recent file(s)); see what_finfo. |
what_finfo |
What file.info field type should be used for filtering? Defaults to |
only_last |
Should only the last file found be returned? Defaults to |
fmt |
|
print_limit |
Optional integer. How many found results should be printed? Defaults to 6. This ONLY affects display results, NOT returned results! |
... |
Other arguments to pass to list.files, aside from |
This is most useful for filtering out multiple files with similar or identical file names within a single parent
dir, regardless of nesting, by one of ctime,mtime,atime
as denoted by file.info. By default, the timestamp
used is ctime
.
Beware if using directly for reading-in, as this function will list all files found according to input criteria, although it will also return only the last file found, by default. Nonetheless, you should apply additional constraints for non-interactive use, e.g. specifying a more specific path and/or pattern.
A vector of files (full path names) that meet the type criteria (earliest or latest) and any other constraints, within the scope of the specified dir.
x <- list.files(R.home("doc"), full.names = TRUE) ctime_filt(x) #use defaults ctime_filt(x, pattern = ".html|.png", type = "max")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.