Skip to contents

find most recent files of a specific type

Usage

most_recent_files(
  type = "",
  subtype = NULL,
  reproduce_at = as.Date(getOption("reproduce.at", default = Sys.Date()))
)

Arguments

type

see valid_inputs() for current list of supported types in input directory

subtype

see valid_inputs() for list of supported filenames

reproduce_at

after this date new files are ignored. This enforces a specific version of the data.

Value

a list of the file paths to the most up to date files of the given type relevant to each site and study year

Examples


# devtools::load_all()
try({
  avoncap::set_input("~/Data/avoncap")
  avoncap::input("nhs-extract")

  avoncap::all_files()


  # exact match on filename column of all_data()
  avoncap::most_recent_files("AvonCAPLRTDCentralDa")


  # or matches by lower case startWith on directory
  avoncap::most_recent_files("nhs-extract","deltave")


  avoncap::most_recent_files("metadata")

  avoncap::valid_inputs()
})
#> Found data directory: /home/vp22681/Data/avoncap
#> # A tibble: 32 × 3
#> # Groups:   type [8]
#>    type                 subtype      file                        
#>    <chr>                <chr>        <chr>                       
#>  1 admission-dates      NA           central                     
#>  2 avoncap-data-quality NA           confirmed-missing-2023-08-07
#>  3 avoncap-export       central      central_y1                  
#>  4 avoncap-export       central      central_y2                  
#>  5 avoncap-export       uad-controls uad-controls                
#>  6 avoncap-export       central      central_y3                  
#>  7 avoncap-export       gp           gp                          
#>  8 avoncap-export       ed           ed_y3                       
#>  9 avoncap-export       central      central_y4                  
#> 10 ethnicity            NA           y1                          
#> # ℹ 22 more rows