How do I touch
a file (i.e., update its modification time without changing its contents) in R? I'm looking for a cross-platform built-in (or packaged) equivalent of:
system2("touch", file_name)
I have found an implementation in the R.utils
package, it utilizes the same pattern as suggested by @thelatemail but also offers vectorization and a fallback for R < 2.14, and invisibly returns the old timestamp:
R.utils::touchFile(file_name)
As usual, library(sos); ???touch
was invaluable for finding this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With