To find the last modified date of a directory in R, you can use the file.info()
function to get information about the directory, including its modification date. Here's an example:
main.r306 chars12 lines
In this example, dir_path
is the path of the directory you want to check. The file.info()
function returns a list of properties for the specified file or directory, including the modification time (mtime
). We store this list of properties in dir_info
. The mtime
property is stored as a POSIXct object, which represents a date and time. We can access this object using the $
operator and store it in mod_date
. Finally, we print mod_date
to see the modification date of the directory.
gistlibby LogSnag