@@ -51,20 +51,25 @@ retrieveDictionary <- function(name) {
5151 }
5252}
5353
54- saveDictionary <- function (name , dictionary ) {
55- # Save in the globals environment
54+
55+ saveDictionary <- function (name , dictionary , overwrite = TRUE ) {
56+ # Save in the globals environment
57+
5658 assign(name , dictionary , globals )
5759
5860 # -------------------------------
5961 # 1️⃣ Save CRAN/GitHub-compliant copy (/data/)
6062 # -------------------------------
61- data_path <- file.path(getwd(), " data" ) # always dev source tree
63+
64+ data_path <- file.path(getwd(), " data" )
65+
6266 if (! dir.exists(data_path )) dir.create(data_path , recursive = TRUE )
6367
6468 save(list = name ,
65- file = file.path(data_path , paste0(name , " .rdata " )),
69+ file = file.path(data_path , paste0(name , " .rda " )),
6670 envir = globals )
6771
72+
6873 # -------------------------------
6974 # 2️⃣ Save dev copy (/inst/data/) for load_all() testing
7075 # -------------------------------
@@ -74,6 +79,9 @@ saveDictionary <- function(name, dictionary) {
7479 save(list = name ,
7580 file = file.path(inst_path , paste0(name , " .rdata" )),
7681 envir = globals )
82+ message(" Dictionary '" , name , " ' saved to:\n " ,
83+ " - " , file.path(data_path , paste0(name , " .rda" )), " \n " ,
84+ " - " , file.path(inst_path , paste0(name , " .rdata" )))
7785}
7886
7987# ' Checks a dictionary
0 commit comments