Skip to contents

Create Standardized File Names

Usage

create_zip_file_names(
  file_names,
  remove = ".zip|week|npidata_pfile_",
  format = "%m%d%y",
  collapse = "|",
  left = "week:",
  right = ""
)

Arguments

file_names

a vector of file names

remove

regex pattern to remove from file names

format

date format

collapse

delimiter

left

string to prepend to file names

right

string to append to file names

Value

a vector of transformed file names

Examples

c("week123019_010520.zip",
   "week122622_010123.zip",
   "week122820_010321.zip",
   "week122721_010222.zip",
   "week122616_010117.zip",
   "week123118_010619.zip",
   "week122815_010316.zip",
   "week080315_080915.zip") |>
   create_zip_file_names()
#> [1] "week:2019-12-30|2020-01-05" "week:2022-12-26|2023-01-01"
#> [3] "week:2020-12-28|2021-01-03" "week:2021-12-27|2022-01-02"
#> [5] "week:2016-12-26|2017-01-01" "week:2018-12-31|2019-01-06"
#> [7] "week:2015-12-28|2016-01-03" "week:2015-08-03|2015-08-09"