From 5931fe5b3314ac9867d7eb8437f0ef6bccb60458 Mon Sep 17 00:00:00 2001 From: Bruno Mioto Date: Fri, 3 Jun 2022 15:21:04 -0300 Subject: [PATCH] Error when saving with filename already saved --- R/rspeciesLink.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/rspeciesLink.R b/R/rspeciesLink.R index 1062dcc..7b69729 100644 --- a/R/rspeciesLink.R +++ b/R/rspeciesLink.R @@ -215,6 +215,10 @@ rspeciesLink <- function(dir = "results/", # creating dir if (!dir.exists(dir)) {dir.create(dir)} fullname <- paste0(dir, filename, ".csv") + # if filename already exists + if (file.exists(fullname)) { + stop(paste0(filename, ".csv already saved on disk. Please, choose another filename")) + } message(paste0("Writing ", fullname, " on disk.")) write.table(x = df, file = fullname,