Reputation: 11411
Given the following code:
x <- 1
save(x, file = "x")
file.remove("x")
The file.remove()
command successfully removes the x file. However, it returns TRUE
to the R console. How do I keep it from doing that?
I've tried things like file.remove("x", silent = TRUE)
, but it seems that whatever I add to the function is interpreted as a file name, since the above returns cannot remove file 'TRUE', reason 'No such file or directory'
.
Upvotes: 5
Views: 1994
Reputation: 99381
Try wrapping the call with invisible
x <- 1
save(x, file = "x")
invisible(file.remove("x"))
Upvotes: 15