Results of file.info if file doesn't exist

I clearly don't understand what file.info() returns when a file doesn't exist. How come "z.mtime not found" rather than it's an NA?

> z <- file.info("foo")
> z
    size isdir mode mtime ctime atime  exe
foo   NA    NA <NA>  <NA>  <NA>  <NA> <NA>
> is.na(z.mtime)
Error: object 'z.mtime' not found

Get the column with $ not .

z <- file.info("foo")
z
#>     size isdir mode mtime ctime atime  exe
#> foo   NA    NA <NA>  <NA>  <NA>  <NA> <NA>
z$mtime
#> [1] NA

Created on 2024-05-15 with reprex v2.0.2

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.