Closed jordansread closed 2 years ago
I remember this being a really annoying detail and just made it force the user to be really explicit.
Am rereading the documentation and don't really see where you think I would change it... :/
From the docs it is unclear what happens when you have add_to_existing
= TRUE and overwrite
= TRUE. Based on you telling me people need to be really explicit, I am assuming the existing file is deleted and the add_to_existing
arg is ignored.
I haven't played around with this though. I guess it errors if the file exists and overwrite
is TRUE? Why wouldn't it just overwrite it if that is the case? From docs:
overwrite boolean error if file exists
So this is all the logic for overwrite
and add to existing.
if(!overwrite & !add_to_existing & file.exists(nc_file)) stop("File already exists and overwrite is false.")
if(overwrite & !add_to_existing) unlink(file.exists(nc_file))
if(add_to_existing & !file.exists(nc_file)) add_to_existing=FALSE
overwrite = TRUE
and add_to_existing = TRUE
it won't delete the file and will add to it.overwrite = FALSE
and add_to_existing = TRUE
it won't touch the file and will add to it.overwrite = TRUE
and add_to_existing = FALSE
it will delete the file and start fresh.overwrite = FALSE
and add_to_existing = FALSE
and the file exists, it will error, otherwise it will create a fresh file.These seem logical to me and the docs make OK sense.
I modified the docs for overwrite to read: overwrite: boolean unless set to true, error if file exists.
With that change, do you think we can close this issue?
Seems
overwrite
would be ignored ifadd_to_existing
is TRUE. Doc says it will error if the file exists.Perhaps the doc is right and it will error if there is a file regardless of whether you want to add to it. Or perhaps this isn't the way it behaves and the docs should let you know it is ignored if you are adding to an existing file.