[Get Latest rds File] Get the latest rds file from a a directory with time-stamped files #r
#-- get latest rds file from filelisting with datestamps
get_latest_rds <- function(d, kw){
ls <- list.files(d, pattern = "*.rds", full.names = T)
f <- sort(ls[grepl(kw, ls)], decreasing = T)[1]
d <- readRDS(f)
cat(paste("Fetched", f, "--", nrow(d), "rows", ncol(d), "columns\n"))
return(d)
}