On 22 July 2009 at 09:44, Erin Hodgess wrote:
| I am looking at the ctime attribute of two different files. It
| contains the year, month, day, time of creation and time zone.
[ Well only if you convert it to POSIXlt... ]
| Is there a way to determine the difference between the ctimes of two
| files, please?
Just use '-' or the difftime() functions. As help(file.info) clearly states, the
class of the ctime component is a standard POSIXct and your problem reduces
to the common difference between two POSIXct times. Which R happens to excel
at:
> bashrc <- file.info("~/.bashrc")$ctime
> Rprofile <- file.info("~/.Rprofile")$ctime
> Rprofile - bashrc
Time difference of 52.57426 days
> difftime(Rprofile, bashrc, units="weeks")
Time difference of 7.510608 weeks
See ?difftime for other units, and use as.numeric() to cast to just a number.
Hth, Dirk
--
Three out of two people have difficulties with fractions.
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.