Reputation: 1196
If I execute the following R code, a file will be created
png('tempfile.png', width = 500, height = 500)
plot(1:10)
dev.off()
If I don't plot anything. No file is created.
png('tempfile.png', width = 500, height = 500)
#plot(1:10)
dev.off()
What is the best way to check whether the file was created at all?
Upvotes: 0
Views: 35
Reputation: 19970
You can use file.exists
file.exists("tempfile.png")
If you are modifying files you can also check when a file was last modified with file.info
in the mtime
column. There is also creation time ctime
and last access time atime
along with a few other metrics that may or may not be of interest to you.
Upvotes: 2