file.info(...)
size : Integer, file size in bytes.
isdir : Logical, TRUE if the name is a directory.
mode : Integer, the file permissions.
mtime, ctime, atime : Integers, file modification, change, and access times.
This function emulates the R function
file.info
,
but their return values differ. In R, the data frame columns are:
size, isdir, mode, mtime, ctime, atime, uid, gid, uname, and grname.
In R, the mode is the octal value for the file permissions, for example '644'.
But in S-PLUS, it is the mode value returned by the system function
stat()
and contains more than just file permissions.
Currently the time values, mtime, ctime, and atime, are returned as integers, but a future version will return those as objects of class "timeDate."
# get sizes of S-PLUS PDF files (substitute "help" for "doc" on Windows) file.info(dir(file.path(getenv("SHOME"),"doc"),full.names=T,pattern="pdf$"))[1]
# convert modification time to a "timeDate" object asTimeDate <- function(seconds, zone = "PST") { seconds.per.day <- 60 * 60 * 24 days <- seconds %/% seconds.per.day msec <- 1000 * (seconds %% seconds.per.day) val <- timeDate(julian = days, ms = msec, zone = zone, in.origin = c( month = 1, day = 1, year = 1970)) val } asTimeDate(file.info(".")$mtime)