| latest_file | R Documentation |
Looks for files in a directory path with file name matching pattern. The path of the nth
file, ordered alphabetically by file name is returned. "File name" here refers to the part of
the path without any directory names i.e. the part following the final "/".
The intended use is with files names with matching structure with well-ordered numeric endings, such as "yyyy-mm-dd" or fixed length numeric ids. Output may not be as intended if comparing files with different structures.
latest_file(
path = ".",
pattern = NULL,
ext = NULL,
n = 1L,
decreasing = TRUE,
...
)
path |
A string path name for the directory to search in. |
pattern |
A string pattern to filter file names by. The pattern is only applied to the part of the path following the final "/". |
ext |
An optional string giving a file extension which the returned file name must end in. The supplied extension is checked for an exact match (ignoring case) to the last extension in the file name. |
n |
Integer. Return the nth file path. This can have length > 1, in which case multiple file paths are returned. An error will be thrown if there are insufficient matches. |
decreasing |
Logical passed to |
... |
Other arguments passed to |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.