Hi,
I am writing a program that returns the a vector of the most recent R files in a
given dir.
The files are named like "f1.R", "f2.R", and sometimes
"f3a.R". I want to use the resulting
vector to easily source() all the most recent file versions of a given dir.
Here's what I've cooked up till sofar:
library(plyr)
rfiles <- Sys.glob("G:\\temp\\*.R")
rfiles2 <- data.frame(rfiles, mtime = ldply(rfiles,
"file.info")[,"mtime"])
rfiles2$basename <- gsub("([0-9]+[a-z]?)\\.R", "",
rfiles)
srt <- with(rfiles2, order(rfiles, mtime))
rfiles2[srt,][!duplicated(rfiles2$basename),] # does not work
Thank you in advance!
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system, and public health, what have the
Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[alternative HTML version deleted]]