get_latest_data_file_names: Gets the latest downloaded files (in terms of date) from the...

Description Usage Arguments Value Examples

View source: R/get_latest_data_file_names.R

Description

Gets the latest downloaded files (in terms of date) from the provided from_directory, as well as the date reflected in the filenames. If no arguments are provided, the directory is assumed to be the '~/Downloads/' folder.

Usage

1
get_latest_data_file_names(from_directory = "~/Downloads/", patterns)

Arguments

from_directory

A directory where to find the latest data.

patterns

A key-value pairs vector containing the label and regex pattern.

Value

A vector containing key-value pairs where the keys are the labels in 'patterns' and the values are the latest file names according to the patterns.

Examples

1
2
3
4
5
6
7
8
9
dataDict <- 'AnimalIdentification_DataDictionary_2018-07-06.csv'
data <- 'AnimalIdentification_Data_2018-07-06_1604.csv'
write.csv("", file.path(system.file(), dataDict))
write.csv("", file.path(system.file(), data))
patterns <- c("data" = "AnimalIdentification_Data_20\\d\\d.*\\.csv",
"metadata" = "AnimalIdentification_DataDictionary_20\\d\\d.*\\.csv",
"date" = "\\d{4}-\\d{2}-\\d{2}")
get_latest_data_file_names(system.file(), patterns)
file.remove(c(file.path(system.file(), dataDict), file.path(system.file(), data)))

ctsit/rdatil documentation built on May 26, 2019, 12:31 p.m.