I have multiple excel files in multiple directories that I am reading into R. However, I don't want to read in EVERY excel file; I only want to read in the most recent ones (for example, only the ones created in the last month). Is there a way to do this?

Currently I am using this to read in all of the excel files, which is working just fine:

filenames <- Sys.glob(file.path('(name of dir)', "19*", "Electrode*02.xlsx")) <br> 
elecsheet <- do.call("cbind", lapply(filenames, read_excel))

Somewhere in this second line of code (I think), I need to tell R to look at the metadata and only read in the excel files that have been created since a certain date. Thank you!

0

There are 0 best solutions below